This seems to be a common question, but i am unable to find out a straight away answer.
I get JSONObject
from server, each activity needs to access it and get some data from it, that's the reason i am more concerned about the performance here.
This is what i do. Following operation runs for each activity.
DatabaseHandler db = new DatabaseHandler(context);
dataObject = db.getAllData();
jsonObject = new JSONObject(dataObject );
value = jsonObject.optString(key);
The data is pretty straight forward, its a simple JsonObject
, i can also put this in sharedPreference
, but before moving to sharedPreference
, i want to be sure that sharedPreference
are faster than sqlite database
, or moving to sharedPreference
can give me performance improvement.