I know, there are plenty of questions in regards to saving/retrieving data on here. I was doing find looking things up on my own and really thought I could manage to find m
Best way to achieve that is:
MySettings.load(). This load method sets the arraysave() method. Public also. Now you can save from anywhere in you app. This save() method reads the array and writes in SharedPreferencesCode sample:
public class MySettings {
private static List data;
public static void load() {
data = new ArrayList();
// use SharedPreferences to retrieve all your data
}
public static void save() {
// save all contents from data
}
public static List getData() {
return data;
}
public static void setData(List data) {
MySettings.data = data;
}
}