这就是我所拥有的。
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秒钟下载连接。