我正在尝试在图像列表视图中动态显示图像预览,但每次都得到空位图。
File f1 = new File("/mnt/sdcard/DCIP/myImage.jpg");
Bitmap bitMap = BitmapFactory.decodeFile(f1.getAbsolutePath());
/* here bitMap becomes null */
imageView.setImageBitmap(bitMap);
Don't use fixed SDCard url, its not same in every Android devices.
For e.g.
/mnt/sdcard/
/sdcard
Instead use getExternalStorageDirectory().
For example:
String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();