I have an ArrayList
with custom objects. Each custom object contains a variety of strings and numbers. I need the array to stick around even if the user leaves
The best way i have been able to find is a make a 2D Array of keys and put the custom items of the array in the 2-D array of keys and then retrieve it through the 2D arra on startup. I did not like the idea of using string set because most of the android users are still on Gingerbread and using string set requires honeycomb.
Sample Code: here ditor is the shared pref editor and rowitem is my custom object.
editor.putString(genrealfeedkey[j][1], Rowitemslist.get(j).getname());
editor.putString(genrealfeedkey[j][2], Rowitemslist.get(j).getdescription());
editor.putString(genrealfeedkey[j][3], Rowitemslist.get(j).getlink());
editor.putString(genrealfeedkey[j][4], Rowitemslist.get(j).getid());
editor.putString(genrealfeedkey[j][5], Rowitemslist.get(j).getmessage());