EggRollMan
EggRollMan

Reputation: 583

Clear BitMap Cache - koush ion

i would like to clear bitmap cache but i am not sure how to clear the bit map . I am using Koush Ion library to load the picture

try {
            bitmap = Ion.with(context).load(URLimage).withBitmap().asBitmap().get();
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ExecutionException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

i need to clear the bitmap cache everytime i click on a button. Thanks in advance

Upvotes: 4

Views: 1836

Answers (2)

andreyrd
andreyrd

Reputation: 1130

Use Ion.getDefault(context).getCache().clear() to clear the file cache.

Use Ion.getDefault(context).getBitmapCache().clear() to clear the in-memory bitmap cache.

See the source for the respective methods at: https://github.com/koush/AndroidAsync/blob/master/AndroidAsync/src/com/koushikdutta/async/util/FileCache.java#L292 https://github.com/koush/ion/blob/master/ion/src/com/koushikdutta/ion/bitmap/IonBitmapCache.java#L63

Ion.dump() will NOT clear the cache. It will simply print some debug information to the log. You can look up the source code for it, too.

Upvotes: 5

Ameen Maheen
Ameen Maheen

Reputation: 2747

try this may help,,i used this code for clearing my network data cache;

Ion.getDefault(context).configure().getResponseCache().clear()

Upvotes: 1

Related Questions