xyz rety xyz rety - 1 year ago 148
Android Question

set SD card image to ImageView?

i have an images in SD card i want to take image from SD card and set in the ImageView.please help me guys i have no idea how can i do this.

i tried this:

sendImageFromFolder.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {

Uri uri=null;
ArrayList<Uri> arrayList=new ArrayList<Uri>();
ImageView imageView= (ImageView) findViewById(;

File pictues= Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
String[] listOfPictures=pictues.list();
for(String s:listOfPictures){
uri=Uri.parse("file://"+ pictues.toString() +"/"+s);


InputStream inputStream = null;
FileOutputStream fileOutputStream=null;
Bitmap bmp;

try {
inputStream = getContentResolver().openInputStream(arrayList.get(0));
} catch (FileNotFoundException e) {
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
bmp = BitmapFactory.decodeStream(bufferedInputStream);



Answer Source
 File pictureFile = new File("Path to your image");
 Bitmap bitmap = BitmapFactory.decodeFile(pictureFile.getAbsolutePath());
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download