0
我在我的应用程序中使用UIL lib,我从我的Amazon S3服务器获取图像。
我已经覆盖了BaseImageDownloader
类:Android通用图像加载器,停止重试
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不断重试一遍又一遍地加载图像。如果没有这样的图像,我希望不要再试一次。