gpt4 book ai didi

java - Android:UIL 我希望能够多次加载同一张图像

转载 作者:太空宇宙 更新时间:2023-11-04 14:04:12 30 4
gpt4 key购买 nike

所以每当我多次使用同一个图像时,它就会被取消。所以我希望你们能帮助我我想使用该图像作为标记图标

这是我的代码:

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");
}
});

最佳答案

我解决了我的问题。对于仍在寻找答案的人,我所做的是:

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");
}
});

关于java - Android:UIL 我希望能够多次加载同一张图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29029003/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com