开发者

Getting imageview to read image from sd

开发者 https://www.devze.com 2023-03-20 08:58 出处:网络
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 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消