我使用这个意图让用户选择一张照片:
Intent intent = new Intent(Intent.ACTION_PICK,
MediaStore.Images.Media.INTERNAL_CONTENT_URI);
startActivityForResult(intent, INTENT_SELECT_PHOTO);
并在onActivityResult
:
Uri uri = data.getData();
InputStream inputStream = getContentResolver().openInputStream(uri);
但它会FileNotFoundException
在一些安卓设备上抛出。
的价值uri
:
content://media/external/images/media/26467
抛出的异常:
java.io.FileNotFoundException: No such file or directory
而且很奇怪,它不会在其他一些android设备上抛出这个异常。什么会导致此错误以及如何解决?