1

I have a imageview and a camera button in Activity A. By clicking on the camera button will go to my custom camera activity. After taking a picture and storing it into a folder, how can I reflect this newly picture taken in the imageview after finishing the camera activity? Any help will be appreciated ?

A(main) > B(camera activity) > A(main) Imageview is updated with new picture taken.

Thanks.

Nikunj Patel
  • 21,853
  • 23
  • 89
  • 133
AndroidBase
  • 41
  • 2
  • 5
  • Please check below link more helpful to you http://stackoverflow.com/questions/5991319/capture-image-from-camera-and-display-in-activity – Nikhil Jul 14 '11 at 05:14

1 Answers1

3

According to my understanding of your question, you want to know how to set an image, residing on sdCard, to an ImageView. Well, let's say you can get the image path from your camera activity and then you can do something like below:

  String imageInSD = "/sdcard/img.PNG";      
  Bitmap bitmap = BitmapFactory.decodeFile(imageInSD);
  ImageView myImageView = (ImageView)findViewById(R.id.imageview);
  myImageView.setImageBitmap(bitmap);

I hope it'll serve the purpose, if this is what you want.

Khawar
  • 5,197
  • 4
  • 28
  • 52
  • Yep, I have already implemented this part. The problem is when i finish taking a picture and press the back button on the device, it doesn't update the imageview. I was thinking of using startActivityForResult since the activity B is stack on top of activity A. – AndroidBase Jul 14 '11 at 06:22
  • Yes then you should return the path from camera activity to the previous activity. – Khawar Jul 14 '11 at 06:32