You need to be saving that setting somewhere. Then those settings (likely saved in a text file or xml file) should be read into the program & dealt with appropriately.
Every time you restart your program, regardless of what the user interactions were before, its a "clean slate". Thus, you must reference from something (text/xml) that is not cleared on restart.
void createFile() throws IOException{
Path p = Paths.get("myPath.txt");
Files.createFile(p);
}
void readFromFile() throws Exception {
BufferedReader br = new BufferedReader(new FileReader(""));
ArrayList<String> myStringArray = new ArrayList<>();
myStringArray.add(br.readLine());
br.close();
}
Now, you have the strings from the file in your ArrayList<?> myStringArray
, and you may read through it & decide what to do with the associated information.
There is, however, a better way to do this using the sharedpreferences as linked by other community members.