A
A
Artix2015-02-27 13:03:17
Android
Artix, 2015-02-27 13:03:17

Which is better to use, SQLite, save to file or SharedPreferences?

Through what is it better to implement the history of visiting something in the android application, i.e. which is better to choose from the question listed in the title? I will give an example, here is a ListView which is filled through

List<Map<String, String>> array = new ArrayList<Map<String, String>>;
and it needs to be saved every time an element is added, I tried it through a file, but however this procedure reduces performance, and when you turn on a fragment with this LV, the application slows down a lot for a while (since it loads the Map from a file), even AsyncTask did not help here.
In addition, I need to remove duplicate elements from the ListView, and after loading from a file, the application does not seem to see what was loaded from the file, and removes from the newly added, but not saved elements, i.e. those that have not yet gone to the file, and those that have been loaded, it ignores. But that is another story.
I heard that when converting to a JSON string, and then to SharedPreferences, you can also grab performance if the array is large, and besides that, I need to save not just an ArrayList, but a Map, i.e. you need to store an object, not a string through a for loop. What can you advise in this case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arthur Asatryan, 2015-02-27
@nikkorejz

in fact the best solution for you would be a relational database, sqlite. Performance in search and data persistence. Yes, and subsequent implementations will be flexible / nimble

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question