nostra13/Android-Universal-Image-Loader

Not receive response in onLoadingFailed when disk is full

javieritis opened this issue · 0 comments

@nostra13

i have this code attached next, and implement listener. Not receive data about when disk is full.
My configuration is LimitedAgeDiskCache.

and the log receive this message:

01-25 11:21:45.256 20425-20600/? E/ImageLoader: write failed: ENOSPC (No space left on device) java.io.IOException: write failed: ENOSPC (No space left on device) at libcore.io.IoBridge.write(IoBridge.java:533) at java.io.FileOutputStream.write(FileOutputStream.java:186) at java.io.BufferedOutputStream.flushInternal(BufferedOutputStream.java:185) at java.io.BufferedOutputStream.write(BufferedOutputStream.java:139) at com.nostra13.universalimageloader.utils.IoUtils.copyStream(IoUtils.java:78) at com.nostra13.universalimageloader.cache.disc.impl.BaseDiskCache.save(BaseDiskCache.java:109) at com.nostra13.universalimageloader.cache.disc.impl.LimitedAgeDiskCache.save(LimitedAgeDiskCache.java:97) at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.downloadImage(LoadAndDisplayImageTask.java:297) at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryCacheImageOnDisk(LoadAndDisplayImageTask.java:274) at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:230) at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:136) etc.... 

My code helper for load images:

`

public static void loadImagePlaceHolderProfileFeed(String urlToLoad, ImageView imageView) {
    ImageLoader.getInstance().displayImage(urlToLoad, imageView, getOptionsInMemoryPlaceHolderProfileFeed(), imageLoadingListener);
}

`

public static void loadImagePlaceHolderImageFeed(String urlToLoad, ImageView imageView) {
    ImageLoader.getInstance().displayImage(urlToLoad, imageView, getOptionsInMemory(), imageLoadingListener);
}

and the listener, for capture error full disk #178

private static ImageLoadingListener imageLoadingListener = new ImageLoadingListener() {
    @Override
    public void onLoadingStarted(String imageUri, View view) {

    }

    @Override
    public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
        switch (failReason.getType()) {
            case IO_ERROR:
                String errorMessage = failReason.getCause().getMessage();
                if ("No space left on device".equals(errorMessage)) {
                    Log.d("image loader full disk", "full disk, clear cache please!!!");
                }
                break;
        }
    }

    @Override
    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {

    }

    @Override
    public void onLoadingCancelled(String imageUri, View view) {
    }
};

Any Solution so that I can capture the fault and be able to eliminate the memory?

thank you very much!