Skip to content Skip to sidebar Skip to footer

Best Way To Store Data In Android

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. SQLi

Solution 1:

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.

Solution 2:

I recently discovered db4o [http://www.db4o.com/android/]. It's not the best choice to store logs but if you want to store the data in your object this is certainly an excellent alternative to SQLite.

Solution 3:

You can also keep the data inside the XML file created by your application. In many applications I have done so .And using any SAX or DOM parser you can retrieve data smoothly. No other application can access that XML.

Hope this helps

Post a Comment for "Best Way To Store Data In Android"