【发布时间】:2013-07-27 14:33:57
【问题描述】:
我在我的应用程序中使用相机。我需要拍照并且应该在imageview 中显示它。我正在使用以下代码从相机拍照并显示它。
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, capturedImageUri);
startActivityForResult(intent, 0);
imageView.setImageURI(capturedImageUri);
这仅适用于两个或有时三个图像,然后imageview 不显示图像,但图像是正确的stored in SD card。
或者我也使用过
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeFile(photoPath, options);
Imageview.setImageBitmap(bitmap);
但我也面临同样的问题。谁能帮帮我。
【问题讨论】:
-
logcat 中是否出现任何错误?
-
您有任何错误吗?您似乎正在尝试显示相机拍摄的全尺寸图像,这会消耗过多的内存。
-
没有。它不显示任何错误。我也检查了文件大小。它与显示图像几乎相同。我也试过压缩。我仍然面临同样的问题。