I've been trying to use the CacheManager for caching some http requests but it failed every time with a nullpointer exception. After some digging I believe I found out why:
CacheManager.getCacheFileBaseDir()
always returns null so when I try
to use CacheManager.getCacheFile()
or CacheManager.saveCacheFile()
they fail.
CacheManager.cacheDisabled()
returns false.
I hadn 't created a cache partition via the AVD manager so I thought
the problem lie there. But after creating a cache partition
getCacheFile()
still return null:
03-16 00:25:16.321: ERROR/AndroidRuntime(296): Caused by: java.lang.NullPointerException
03-16 00:25:16.321: ERROR/AndroidRuntime(296): at android.webkit.CacheManager.getCacheFile(CacheManager.java:296)
What could be the problem? I've got the code posted here: http://pastebin.com/eaJwfXEK But it's a bit messy because I've been trying tons of stuff.
Why does CacheManager.getCacheFileBaseDir()
return null and not a File object?