Luke Batley
Luke Batley

Reputation: 2402

Storing data from a JSON Feed locally Android

Hi I'm trying to find out about storing a JSON Feed locally on the phone, so that it may then be used globally and offline. For example in iOS I wrote it to a empty pList and I'm looking for the equivalent of that on Android.
For example is it better to write to XML or create a .JSON file and how do I go about writing to/reading this file to then reuse the data

Upvotes: 1

Views: 1338

Answers (4)

skyfishjy
skyfishjy

Reputation: 2049

Google I/O App for Android: iosched is a good example for you, it use .json in /res/raw to store its data.

Also, google-gson will save you much time if you work with json data and you will feel surprise when developing.

Finally, if you need to know how to reuse the data globally and offline. This video Android REST client applications is really useful.

Upvotes: 1

Klawikowski
Klawikowski

Reputation: 615

The easiest mode to store it is to save it in SharedPreferences. It is the fast and save / secure way to store String values which JSON is ; )

Upvotes: 1

Zabador
Zabador

Reputation: 727

I have a class that grabs the json feed and then I turn it into a string and save it in a database along with the cookie that is currently used. So I can re-check the log in status onResume().

Upvotes: 1

Androider
Androider

Reputation: 2804

You can save data in DB, or you can also save json file and read data when required.

Upvotes: 2

Related Questions