【发布时间】:2012-06-09 04:25:08
【问题描述】:
我在 onActivityResult 中使用了以下代码,但它不起作用
File file1 = new File( Environment.getExternalStorageDirectory().getAbsolutePath(),imagecapture);
if (file1.exists()) {
//Do action
image=(ImageView)findViewById(R.id.image);
Bitmap myBitmap = BitmapFactory.decodeFile(file1.getAbsolutePath());
image.setImageBitmap(myBitmap);
image.invalidate();
}
但我不知道为什么它不工作我也用过
Android Camera Intent: how to get full sized photo?
但它在mImageUri = Uri.fromFile(photo);线上给出了错误
任何帮助将不胜感激。
【问题讨论】:
-
上面的代码没有错误但也没有显示图像但是当我在oncreate中使用它时它正在工作但我希望它在onActivityResult中工作
-
@Shrikant 你能给出任何教程或任何其他提示我怎样才能达到同样的效果
-
我在想解决办法...你检查过file1是否真的存在吗?
-
是的,我已经调试了它正在进入 if 语句
标签: android android-camera android-imageview