【发布时间】:2015-03-08 15:31:15
【问题描述】:
我正在尝试打开存储在外部存储器中的图像。这是我的代码:
File imagePath = new File(imageURI);
InputStream inputStream=null;
try {
inputStream = getContentResolver().openInputStream(Uri.parse(imageURI));
}catch(FileNotFoundException e){
e.printStackTrace();
}
Bitmap bm = BitmapFactory.decodeStream(inputStream);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] originalImage = baos.toByteArray();
但它似乎无法找到该文件。 Uri 的格式为 content://com.android.providers.media.documents/document/image%3A21。 感谢您的帮助。
【问题讨论】: