0

I am trying to save user data that is fetched from a server. It's much like a social network with friends to store and user data like name, email, etc.. I was thinking of creating a custom class to handle this or adding these to a sqlitedatabase.

Performance oriented, what is the best way to save these? the sqliteDatabase or the object? I'm thinking that creating objects for every friend the user has, will eat up a lot of memory?

I would like to save these so the app only has to update them when they are changed on the server, saving on data usage and improving performance.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Kenneth Breugelmans
  • 501
  • 1
  • 8
  • 22

2 Answers2

1

If you want the user information to be available even when he is offline , you have two options.

  1. SQLite database

  2. Shared Preferences

If you have a lot of information to store , like a list of friends or a list of tasks , then use the SQLite database. If you have to store little information for ex - mobile number , email address , user id then use shared preferences.

There are other alternatives to the SQLite database where you do not have to write queries. For ex realm

Dishonered
  • 8,449
  • 9
  • 37
  • 50
1

To save data to local memory in android, you have two options:

  1. SQlite DB

  2. SharedPrefrences

To make it simple I would say,

If you have complex and relatively more data, use SQlite.

If you just want to store basic info. in terms of key-value pair, use SharedPreferences.