Reputation: 11337
My Android app is a client that fetchs datas from a Web Service and show them to the user. I would like to know how to improve performance and avoid continuos connections.
Everytime I click the botton "show" for example I make the connection and get the json string. I know that my string will not change during the day (hopefully).
It's better to get the json string and save it in a text file, save the string on a DB (with "date" and "string" columns for example) and then deserialize it, or directly deserialize the string and save as proper objects in the DB?
Thanks a lot!
Upvotes: 0
Views: 315
Reputation: 8477
If it's a little string, say under 1K, put it in Shared Preferences. Otherwise, if your data is going to remain relevant for a few days, use a database. If your data is going to be pretty much thrown out and refreshed completely each day, and is a few KB, write it in a cache file.
Upvotes: 2