CacheManager.getCacheFileBaseDir() always returns null
Posted
by Leon
on Stack Overflow
See other posts from Stack Overflow
or by Leon
Published on 2010-03-16T16:05:40Z
Indexed on
2010/03/17
7:01 UTC
Read the original article
Hit count: 579
Hi,
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 :S
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?
Thanks in advance! Leon
© Stack Overflow or respective owner