Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to store data in Android [closed]

I want to store data in structure form i.e. all information about many call (like call logs). What should I prefer? And I don't want to share my data with other applications.

  1. SQLiteDatabase
  2. ContentProvider
  3. SharedPreference
  4. or File storage
  5. or any way for my requirement which I don't know.
like image 381
Deep Avatar asked Apr 11 '11 05:04

Deep


1 Answers

SharedPreferences is apparently implemented internally as an XML file which is serialized and deserialized in full on update. And it's a Key-Value store with no index. So use that only for simple data associated with your app. Any more than 50 keys and you've probably overdone it.

ContentProvider is intended for sharing data across applications. You've explicitly said you don't want to do that.

SQLiteDatabase is intended for individual apps to store data, and provides a lot of flexibility to store and index data in different ways. I personally use it to store logs in one of my apps. I'd recommend that route.

Another option is to log into ordinary text files stored in file storage.

like image 112
Jim Blackler Avatar answered Sep 21 '22 10:09

Jim Blackler