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());
}
}