看起来一切都很好,但是,UIL 不断抛出这个异常。它们不是致命的,也不会使应用程序崩溃。我的想法是,当它找不到我通过网络 uri 发送的图像时,它就是 UIL 吐出的东西。
下面是一个例外。
java.lang.UnsupportedOperationException: UIL doesn't support scheme(protocol) by default [/assets/attachments_missing/avatars/square_missing.png]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))
com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromOtherSource(BaseImageDownloader.java:206)
com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:95)
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.downloadImage(LoadAndDisplayImageTask.java:340)
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryCacheImageOnDisc(LoadAndDisplayImageTask.java:307)
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:249)
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:131)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
java.lang.Thread.run(Thread.java:1019)
这是我对 UIL 的配置:
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory()
.cacheOnDisc()
.showStubImage(R.drawable.wm_new_thumb)
.showImageOnFail(R.drawable.wm_new_thumb)
.build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.defaultDisplayImageOptions(defaultOptions)
.build();
ImageLoader.getInstance().init(config);