我正在使用一个库从图库中选取图像并且它正在工作,问题是当我将位图设置为imageview时,它会在图库中创建大量重复项
这是代码
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 11 && resultCode == RESULT_OK && data != null) {
ArrayList<Image> images = (ArrayList<Image>) ImagePicker.getImages(data);
for (int i = 0; i < images.size(); i++) {
String s = images.get(i).getPath();
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
try {
bitmap = BitmapFactory.decodeFile(s, bmOptions);
bitmap = Bitmap.createScaledBitmap(bitmap, 200, 200, true);
imagesUrl2.add(bitmap);
uploadImages();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
答案 0 :(得分:0)
问题在于当地uri的滑行加载,它在画廊中创建了很多实例来获取图像,所以我通过了图像的原始uri