4

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

EggRollMan
  • 583
  • 1
  • 8
  • 20

2 Answers2

5

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.

andreyrd
  • 991
  • 7
  • 9
1

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

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

Ameen Maheen
  • 2,719
  • 1
  • 28
  • 28