0

我正在尝试在图像列表视图中动态显示图像预览,但每次都得到空位图。

File f1 = new File("/mnt/sdcard/DCIP/myImage.jpg");
Bitmap bitMap = BitmapFactory.decodeFile(f1.getAbsolutePath());
 /* here bitMap becomes null */
imageView.setImageBitmap(bitMap); 
4

1 回答 1

0

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();
于 2013-01-29T13:30:38.217 回答