【发布时间】:2018-04-20 17:17:27
【问题描述】:
我正在尝试从我的应用程序中的 cam 拍摄照片,但它工作正常但无法在 imageview 中显示它会引发错误..
请帮帮我
我的代码是
在解码 bitmapUri 时出错(我在代码中提到过)
错误是:
private void onCaptureImageResult(Intent 数据) {
Log.w("CAM","capture image result");
launchMediaScanIntent();
try {
File photo = new File(Environment.getExternalStorageDirectory(), "picture.jpg");
Log.w("CAM","decoding bitmap uri");
Context context=FSE_login.this;
Bitmap bitmap = decodeBitmapUri(this, FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".lerainfotech.tezmoney.FSE_login", photo));
Log.w("CAM","decoded");
attendance_pic = Utils.getResizedBitmap(bitmap);
Log.w("CAM","attached");
attendance_pic_field.setImageBitmap(attendance_pic);
} catch (Exception e) {
Log.w("Error Is",e);
Utils.showErrorDialog(getApplicationContext(), "Couldn't load image");
return;
}
}
【问题讨论】:
-
我的错误是:java.io.FileNotFoundException:打开失败:在 android.os.ParcelFileDescriptor.openInternal(ParcelFileDescriptor.java:313) 在 android.os.ParcelFileDescriptor 的 ENOENT(没有这样的文件或目录) .open(ParcelFileDescriptor.java:211) 在 android.support.v4.content.FileProvider.openFile(FileProvider.java:544) 在 android.content.ContentProvider.openAssetFile(ContentProvider.java:1538
标签: android android-intent android-camera android-permissions