Click here to Skip to main content
15,887,358 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an image view after I click on it "A dialog box open with two button,CAMERA and GALLERY.When I click on the CAMERA and capture the photo and placed the capture image on my image view the dialog box still there and won't disappear after placing the photo on the image view.

What I have tried:

Here's my code for Camera:

final AlertDialog builder=new AlertDialog.Builder(getActivity()).create();
builder.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

select_photo_from_camera=(LinearLayout) promptView.findViewById(R.id
.Select_photo_from_Camera);
select_photo_from_gallery=(LinearLayout)promptView.findViewById(R.id
.Select_photo_from_gallery);
builder.setView(promptView);
select_photo_from_camera.setOnClickListener(new View.OnClickListener(){

@Override
public void onClick(View view) {
Intent cameraintent=new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
int CAMERA_PIC_REQUEST=1;
startActivityForResult(cameraintent,CAMERA_PIC_REQUEST);



}
});
builder.show();

Code for retrieving the photo to image view:

@override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode==1 && resultCode==RESULT_OK) {
Bitmap bitmap = (Bitmap) data.getExtras().get("data");
hint_textview_circular_image_view.setVisibility(View.GONE);
Register_add_photo.setImageBitmap(bitmap);
}

}
Posted
Comments
David Crow 30-Mar-18 15:48pm    
"...the dialog box still there and won't disappear after placing the photo on the image view."

Shouldn't you dismiss it?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900