In my Android application, I want to be able to add a string value to a static arraylist, which I declared in my main android activity. The logic is as follows:
1) When you press the button and the action begins. In the oncreate method, I want to save the class name, which is the current activity, for a string value. For instance:
String className = "com.lunchlist.demo";
After this value is assigned, I want to immediately add this string value to the Static ArrayList, which I declared in my main android activity (which means the start of the first Android activity) After adding the value
I did something like this:
static String List<String> members = new ArrayList<String>();
This is announced in my main activity. Now, when I click the button to start another action, I use this to add the string class name for this current activity to my arraylist in my oncreate method:
String className = "com.lunchlist.demo" members.add(className);
Now my question is: will this add the string value to my arraylist and save it for later use? For example, if I press three different buttons, this will add three className values ββto the arraylist. Will it then store a string value that will contain three different string values ββfor my arraylist member? How can I check each element in my array to see if values ββare added when a new action starts?
I ask about this because I will need to get this and save these values ββusing general settings, then restore them and start using, using the string value, which is the class to trigger the activity. I got activity starting with the string value of the class name. I just have problems saving them.