【发布时间】:2015-12-11 15:22:43
【问题描述】:
在android中,当您从图库中获取uri时,它的值将以content://blahblahblah.blahblah.format开头,但如果您从手机的相机中获取uri,它将以file:///开头
下面是我想做的:
private File uriToBitmap(Uri uri, int maxSize) throws FileNotFoundException {
try {
imageStream = getContentResolver().openInputStream(uri);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
Bitmap claimBitmap = BitmapFactory.decodeStream(imageStream);
}
在这个方法中,我想传递一个文件类型 uri 并使用 getContentResolver() 函数,但不幸的是 claimBitmap 是一个null,这是否意味着 getContentResolver() 方法不接受文件类型 uri?请帮忙。
【问题讨论】:
标签: android