I have a screen that contains an ImageView which is not visible to user. User would have to browse for a picture from their Gallery, in which I have successfully coded. I've used toast to ensure that the path to the Image selected is correct and have stored the path to a string. My problem is after selecting the image, how can I draw the selected image on the ImageView by using the path? Is it even possible?
Asked
Active
Viewed 2,057 times
0
-
Hey Matt_K please refer this [Link](http://stackoverflow.com/questions/7304007/take-picture-from-camera-and-choose-from-gallery-and-display-in-image-view) and this [Link](http://stackoverflow.com/questions/7315498/how-to-store-and-retrieve-bitmap-in-sharedpreferences-in-android/7328685#7328685). I hope it will solve your problem. Thanks. – anddev Feb 03 '12 at 08:26
1 Answers
2
Try the below code to set Bitmap images from a file stored inside a SD-Card.
File imgFile = new File("/sdcard/Images/test_image.jpg");
if(imgFile.exists()){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
ImageView myImage = (ImageView) findViewById(R.id.imageviewTest);
myImage.setImageBitmap(myBitmap);
}

Dmytro Danylyk
- 19,684
- 11
- 62
- 68