1

I am using the following code to call capture an image by using the camera.

iv2.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE ); 
                 startActivityForResult(cameraIntent, SELECT_PHOTO);
                imgNo = 2;
            }
        });

In onActivityResult() I am setting the image to an ImageView by using the following code :

Bitmap photo = (Bitmap) imageReturnedIntent.getExtras().get("data"); 
                    Bitmap b=   getCroppedBitmap(getCroppedImage(photo));
                    iv2.setImageBitmap(b);
                    bmpimg2 = b; 
                    iv2.invalidate();

The image is set, but after setting the image the Activity gets refreshed and the image goes away.

How can I solve this error?
Any advice is of great help.

Christopher Marlowe
  • 2,098
  • 6
  • 38
  • 68

0 Answers0