Chris
Chris

Reputation: 7855

Caching Objects parsed from XML in Android

I have an Android application which talks to a public Data-API by calling URLs. The API returns XML which describes search results or detailed Data of a particular dataset.

In my Application i retrieve this data and parse it to Java Objects to display them in a ListView for example.

edit: Just to make it clearer: In my Application you can search for music Artists and get their whole discographic information. I Retrieve the list of Releases and display them in a ListView. (No problem right here, because the results of the same search request can change any minute i have to retrieve this data everytime a search request is issued).

Now i have a list with all the LPs the Beatles produced (for example). I can then click one particular LP and view the Details such as the Release Year and the Tracklist.

What i want to cache is the Details data and i'm currently thinking of which is the best way to do this. I thought of:

What do you think is the best version or is there maybe another better way to achieve caching the results?

Upvotes: 2

Views: 980

Answers (1)

Rajnikant
Rajnikant

Reputation: 1097

serializing an object would be quick solution but that could not be effective solution. Every a time you need to load entire object, while in this case if you are storing your data set into database then, using cursor/queries data handling will be smoother.

CursorAdapter will allow you to plug database cursor directly to list in GUI. I would suggest you to use database approach.

Upvotes: 2

Related Questions