How To Load Image From Sdcard In Android

Steps to load image from sdcard in android

Step 1 — Get the exact image path in sdcard

Step 2 — Create Bitmap from the image path

options.inSampleSize = 8;
final Bitmap b = BitmapFactory.decodeFile("/mnt/sdcard/DCIM/100ANDRO/DSC_0002.jpg",options)

Step 3 — Set the bitmap into imageview


Load Image From Sdcard Example

public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
final ImageView iv = (ImageView)findViewById(;
BitmapFactory.Options options = new BitmapFactory.Options();
// will results in a much smaller image than the original
options.inSampleSize = 8;
final Bitmap b = BitmapFactory.decodeFile("/mnt/sdcard/DCIM/100ANDRO/DSC_0002.jpg", options);

Lead Software Engineer @htcindia | @github contributor | Blog writer @howtodoandroid | Quick Learner