Android 从库中选择图像

Android 从库中选择图像,android,uri,aquery,Android,Uri,Aquery,我正在使用AQuery加载相机拍摄的图像,并将它们显示在“活动”的图像视图中。问题是,当我尝试做同样的事情,但不是拍照,只是从我的图库中选择图像,我的图像视图似乎没有任何内容。这是我的代码: //Get image uri that was selected in gallery Uri selectedImage = data.getData(); //Convert uri to string path strMainPic = selectedImage.toString(); //Cre

我正在使用AQuery加载相机拍摄的图像,并将它们显示在“活动”的图像视图中。问题是,当我尝试做同样的事情,但不是拍照,只是从我的图库中选择图像,我的图像视图似乎没有任何内容。这是我的代码:

//Get image uri that was selected in gallery
Uri selectedImage = data.getData();
//Convert uri to string path
strMainPic = selectedImage.toString();
//Create file to add as parameter to AQuery
File Main = new File(strMainPic);
aq.id(R.id.image_one).image(Main, 100); 

如果我使用
选择的图像
并将其更改为
位图
位图工厂
,它会工作,但性能会受到影响。我做错了什么?

几秒钟前我刚刚解决了这个问题。我使用了以下代码:

Uri selectedImage = data.getData();

try {
    bmp = BitmapFactory.decodeStream(getContentResolver().openInputStream(selectedImage));
} catch (FileNotFoundException e) {
    e.printStackTrace();
}

aq.id(R.id.image_one).image(bmp, AQuery.RATIO_PRESERVE);
我刚刚将它添加到我的
onActivityResult()
方法中