I can’t choose between SQLite and SharedPreferences.
I can use
JSON.parse(SharedPreferences.getString("data","qweqwe");
and
s.putString(key,JSON.stringify(JSONObject));
Or create a new, big class to store my (text) data in SQLite. (PS: JSON.* is my own class)
What will be faster, better?
I know that SharedPreferences is for “key-value” data, SQLite – for big amount of structured data. But in my case storing JSON-formatted data in SP and accessing by key would be easier. Main question – will it be slower or faster? Pros and cons?
I thought about this and had some practice.
So, using SQLite (in my case) is better that using JSON-formatted string in SharedPreferences, because I can just update only one-two rows from a table. With SharedPreferences I have to:
new JSONObject(sharedPreferences.getString("json_string","qweqwe");seasoning to your tasteIMHO, it’s more complicated for the device.
Because it cannot be seasonedIf I wouldn’t need to update an individual parts of data, I’d rather to use SharedPreferences, because for static data, which I don’t need to update, is faster.