Android how to get a running total of a cache file size while using a lazylist?

350 Views Asked by At

Im attempting to program a smart way that my app can check the current size of its cache so that it can delete images on its own if the cache grows to over 1gb which is what android says cache sizes should stay under, however using the 3 methods that I find in the documentation I am struggling at finding one in the File() class that gives an accurate reading as to what the ongoing size really is, the best I have been able to find has been getUsableSpace() however this gives an inaccurate reading as to what the actual remaining cache size really is, the other two methods that seem related are getFreeSpace() and getTotalSpace, however neither of these two totals seem to change their values as I run the app, has anyone done anything like this before? I just need to figure out if my app has used more than 1gb of space so that I can clear the cache

0

There are 0 best solutions below