0
为什么包裹文件描述符抛出FileNotFounException即使imageUri不为空或空。我使用Intent从我的画廊中选择了一个文件。我还敬酒“imageUri”的价值,它打印。ParcelFileDescriptor投掷文件未发现异常
ParcelFileDescriptor percelFileDescriptor;
Toast.makeText(getApplicationContext(),""+imageUri.toString(),Toast.LENGTH_LONG).show();
try {
percelFileDescriptor = getContentResolver().openFileDescriptor(imageUri, "r");
image = BitmapFactory.decodeFileDescriptor(percelFileDescriptor.getFileDescriptor());
modified_img_bitmap = image;
percelFileDescriptor.close();
picked_image.setImageBitmap(image);
} catch (FileNotFoundException e) {
System.out.println("File Not Found: " + e.toString());
Toast.makeText(getApplicationContext(),"File not found: "+e.toString(),Toast.LENGTH_LONG).show();
} catch (IOException e) {
Toast.makeText(getApplicationContext(),"IO Error: "+e.toString(),Toast.LENGTH_LONG).show();
System.out.println("IO Exception: " + e.toString());
}
}