我想解码一个位图,但该函数返回null,我不知道为什么。解码位图返回null
代码:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == SELECT_FOTO)
{
Uri imgselect = data.getData();
String imgpath = imgselect.getPath();
File f = new File (imgpath);
Bitmap bm = BitmapFactory.decodeFile(f.getAbsolutePath());
Toast.makeText(Insertarlugar.this, "Bitmap es" + bm, Toast.LENGTH_LONG).show();
}
的敬酒指示我,BM为空。我为f.getPath()更改了f.getAbsolutePath(),但结果相同。 Uri imgselect和String imgpath有值。我不使用SD卡,并从图库中获取位图。
如何调整位图大小?
谢谢。
首先检查imgpath的值 –
正如我在我的帖子中所说,我检查了imgselect的值。是内容/媒体/外部/图像/媒体/ 11295,所以它有价值。 – axmug