[英]Android: UIL I want to be able to load the same image multiple times
So whenever I am using the same image multiple times, it gets cancelled. 因此,每当我多次使用同一张图片时,它就会被取消。 So I hope you guys can help me I want to use the image as a marker icon
所以我希望你们能帮助我,我想将图像用作标记图标
Here's my code: 这是我的代码:
String uri = "http://192.168.2.8:3000" + articlesArray.getJSONObject(i).getString("icon");
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.loadImage(uri, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
Log.e("tag", "onLoadingStarted");
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
Log.e("tag", "onLoadingFailed");
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
marker.setIcon(BitmapDescriptorFactory.fromBitmap(loadedImage));
Log.e("tag", "onLoadingComplete");
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
Log.e("tag", "onLoadingCancelled");
}
});
I solved my problem. 我解决了我的问题。 For people who are still looking for an answer here is what I did:
对于仍在寻找答案的人们,我的工作是:
String uri = "http://192.168.2.8:3000" + articlesArray.getJSONObject(i).getString("icon");
ImageLoader imageLoader = ImageLoader.getInstance();
ImageSize targetSize = new ImageSize(37, 32);
ImageAware imageAware = new NonViewAware(targetSize, ViewScaleType.CROP);
imageLoader.displayImage(uri,imageAware, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String s, View view) {
Log.e("tag", "onLoadingStarted");
}
@Override
public void onLoadingFailed(String s, View view, FailReason failReason) {
Log.e("tag", "onLoadingFailed");
}
@Override
public void onLoadingComplete(String s, View view, Bitmap bitmap) {
Log.e("tag", "onLoadingComplete");
marker.setIcon(BitmapDescriptorFactory.fromBitmap(bitmap));
}
@Override
public void onLoadingCancelled(String s, View view) {
Log.e("tag", "onLoadingCancelled");
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.