我在我的应用程序中使用相机。我需要拍照并应在imageview
中显示它。我正在使用以下代码从相机拍摄照片并进行显示。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的吗? – JoxTraex
你有什么错误吗?它看起来像你试图显示相机拍摄的全尺寸图像,这将消耗过多的内存。 – Kai
不,它不显示任何错误。我也检查了文件大小。它与显示图像几乎相同。我也尝试过压缩。我仍然面临同样的问题。 – Mathan