Show an image file on the SD card in a view

1 vote · 1 comment

This is a simple routine to show an image file from the SD card in a view. Calling Convention:

ImageView pic = (ImageView)this.findViewById(R.id.picview); 
JBRoutines.ShowPicture(Constants.PICTURE_FILE, pic);
raw ·
copy
· download
public static void ShowPicture(String fileName, ImageView pic) { File f = new File(Environment.getExternalStorageDirectory(), fileName); FileInputStream is = null; try { is = new FileInputStream(f); } catch (FileNotFoundException e) { Log.d("error: ",String.format( "ShowPicture.java file[%s]Not Found",fileName)); return; } Bitmap = BitmapFactory.decodeStream(is, null, null); pic.setImageBitmap(bm); }
Add a comment

1 Comment

good if it's code work

Reply · June 12, 2014, 8:39 p.m.