I'm downloading XML files from the web to display information.  Its
quite taxing on the battery to download stuff from the internet so I
wan't to implement a cache.  I looked at the documentation for
cachemanager but its not very helpful.  Can anyone tell me how to
properly use this?  Here is what I currently have:

I believe I am adding stuff to the cache correctly.
I get the input stream like so:
in = OpenHttpConnection(strSearchURL);
then I put it in a CacheResult object so I can use the CacheManager to
save it.
cr = new CacheResult();
cr.setInputStream(in);
CacheManager.saveCacheFile(strSearchURL, cr);

My problem is getting info from the cache.  Here is what I have:
CacheResult cr = new CacheResult();
cr = CacheManager.getCacheFile(strSearchURL, null);

That gives me a null pointer exception.  I think it may have to do
with the fact that I am passing in null for the second paramater
instead of a Map<String, String>.  But I have no idea how to make that
Map or what should be in it to get what I want.

So, can someone show me a code sample of succesfully using the
cachemanager, or tell me how to fix my code and properly add the Map
to the getCacheFile call?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to