SQLiteDatabase and file storage

I want to save structure type data (i.e. call log information such as name, number, type of number, date, time, duration). What is the best way and which one is faster? SQLiteDatabase (create a table and insert, delete logs in it) or use a file repository (which means to make one class for all parameters and write their objects to a file using Stream I / O and serializable), or in another way that I heard about it , is an XML parser, but I do not know this.

Please help me. Thanks in advance.

+4
source share
4 answers

It depends on what you are trying to do.

If your goal is speed, SQLite will give you a serious run for your money (especially if you invest several investments in transactions). SQLite is optimized for everything you mentioned, and it would be very easy to use the speed that it can give you.

If portability is your goal then files may be a little easier. Files can be moved back and forth easily and easily, while SQLite can take extra effort.

If you manage to search, then you will be a fool not to use SQLite, since it is very good at finding and filtering results.

+3
source

I can’t give a very reasonable answer here because I am as new to this question as you are, but here is a link from the developers page that covers various types of data warehouses. I hope you find this helpful. http://developer.android.com/guide/topics/data/data-storage.html

0
source

Personally, given that you know the basics of databases, I would use a sqlite database. This is pretty straight forward in Android. In terms of speed, I don’t know which is faster, but if you do not have millions of data sets, it does not matter.

0
source

In my experience, in most cases, JSON in the file is enough (basically you need to store an array or object, or just one number or string). I rarely need SQLite (it takes more time to configure and use it).

0
source

Source: https://habr.com/ru/post/1347773/


All Articles