Uri 路径是null
? 如何获取图像 URI 路径?我的代码是:
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.TITLE, "Image File name");
mCapturedImageURI = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
Intent intentPicture = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intentPicture.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageURI);
startActivityForResult(intentPicture,CAMERA_PIC_REQUEST);
OnActivityResult 方法
if (requestCode == CAMERA_PIC_REQUEST && resultCode == RESULT_OK) {
String videoPath = getRealPathFromURI(mCapturedImageURI);
}
但仍然是图像路径null
(空指针异常)