i have async task where i am getting data from server in JSONArray format. I want to save that data in shared preferences and display it in list view. i am using adapter. I have tried but not getting anything
JSONArray arr = new JSONArray(strServerResponse);
JSONObject jsonObj = arr.getJSONObject(0);
for (int i = 0; i < arr.length(); i++) {
pojo = new Pojo();
JSONObject jobj2 = arr.getJSONObject(i);
String tipoftheday = jobj2.optString("tipsoftheday");
ArrayList<String> tii = new ArrayList<String>();
tii.add(tipoftheday);
}
this tip of the day contains multiple data which i want to save in shared preferences and then show in list view. pojo is a class where i have defined setters and getters.
ArrayList<Pojo> tips;
tips = new ArrayList<Pojo>();
pojo.setTip(mydatafromsharedprefernces);
tips.add(pojo);
tipsAdapter = new TipsAdapter(TipsActivity.this, tips);
listTips.setAdapter(tipsAdapter);
how to add the data in shared prefernces. can anyone please help me.