gpt4 book ai didi

java - Image Loader,无法连接到

转载 作者:行者123 更新时间:2023-11-30 09:24:53 26 4
gpt4 key购买 nike

这是我的。

  ImageLoader imageLoader=ImageLoader.getInstance(); 
imageLoader.init(ImageLoaderConfiguration.createDefault(mcontext));
imageLoader.displayImage("http://sunflower-astronomy.com/KCKCC_Docs/LabImages/ngc4631.bmp",imageView)

我在 Logcat 中收到以下错误消息。我的互联网连接正常。我听说您需要对大于 11 的 api 使用 asynctask 进行网络连接。真的吗?这也适用于此吗?

03-19 08:05:38.298: E/ImageLoader(5173): 5000 毫秒后无法连接到 www.sunflower-astronomy.com/69.72.240.50(端口 80)

最佳答案

如果以上代码在您的 UI 线程中运行,那么您应该使用 AsyncTask,否则您的 UI 将在获取图像时锁定。但这不是您的问题的原因。

您的问题是您请求的文件很大,因此 ImageLoader 超时。

要增加超时时间,请在您的 ImageLoaderConfiguration 上使用类似以下内容的内容:.imageDownloader(new URLConnectionImageDownloader(5000, 30000)

这将给它 5 秒的时间来建立连接,并给它 30 秒的时间来下载它。

关于java - Image Loader,无法连接到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15494391/

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