我使用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); 如果我使用selectedImage并将其更改为带有BitmapFactory的Bitmap,它可以工作,但性能会受到影响。我做错了什么?
发布于 2013-08-12 14:28:38
我几秒钟前才解决的。我使用了这个代码:
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()方法中。
https://stackoverflow.com/questions/18188811
复制相似问题