How to open a JPG file as a BITMAP with the JPG stored on the SDCARD? How to open a JPG file as a BITMAP with the JPG stored on the SDCARD? android android

How to open a JPG file as a BITMAP with the JPG stored on the SDCARD?


File root = Environment.getExternalStorageDirectory();ImageView IV = (ImageView) findViewById(R.id."image view");Bitmap bMap = BitmapFactory.decodeFile(root+"/images/01.jpg");IV.setImageBitmap(bMap);

Always try to use Environment.getExternalStorageDirectory(); instead of sdcard.You need an ImageView somewhere in your layout, however that's how I do this kind of things.

I use this code personally too, and it works here.


Any of the BitmapFactory.decode* methods should be able to handle standard JPG files.
If you post some code it could be easier to see why it won't work.