【发布时间】:2014-02-02 07:29:48
【问题描述】:
我在我的应用程序中使用 UIL 库,我从我的 Amazon S3 服务器获取图像。
我已经覆盖了BaseImageDownloader 类:
protected InputStream getStreamFromOtherSource(String imageId, Object extra)
throws IOException {
TransferManager manager = AmazonParams.getTransferManager();
File file = null;
GetObjectRequest req = new GetObjectRequest(AmazonParams.BUCKET, imageId);
try{
file = ImageLoader.getInstance().getDiscCache().get(imageId);
Download d = manager.download(req, file);
while (d.isDone() == false);
}catch (Exception e){
return null;
}
return new FileInputStream(file);
}
但是当我在服务器上遇到 404 错误(没有这样的图像)时,UIL,我返回 null,UIL 不断重试加载图像。如果没有这样的图像,我希望它不要再试了。
【问题讨论】:
标签: android universal-image-loader