I have an Android application with following components: 1) An activity 2) A service 3) A public class with static field.
public class SharedData{
static ArrayList<String> backup = new ArrayList<String>();
}
My understanding is that whenever activity or service is launched for the first time, ArrayList would be initialized.
Here are my questions:
1) When would ArrayList be initialized again? The activity and/or service may start and stop depending on their visibility and Android system resource manager.
2) ArrayList would be modified by both activity and service. Is this going to cause any issues? I have read recommendations about using a class that extends Application. What is the drawback of above approach?