我正在尝试在 android 中显示图像。我使用名为“ image ”的图像视图制作了一个新布局。有问题的字符串是“ SelectedImage =/storage/sdcard0/DCIM/Camera/IMG_20130602_133933.jpg”,代码如下所示:
ImageView imageView1 = (ImageView) findViewById(R.id.imageView1);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 2;
Bitmap bm = BitmapFactory.decodeFile(SelectedImage, options);
imageView1.setImageBitmap(bm);
setContentView(R.layout.image);
当我运行它时它崩溃了。日志说
06-08 21:24:41.192: I/System.out(7642): Not a DRM File, opening notmally
06-08 21:24:41.192: I/System.out(7642): buffer returned
06-08 21:24:41.232: D/AndroidRuntime(7642): Shutting down VM
06-08 21:24:41.232: W/dalvikvm(7642): threadid=1: thread exiting with uncaught exception (group=0x414c1438)