I have an activity which has an array list
ArrayList<String> array = new ArrayList<String>();
i want this array list to be passed to another activity when a Save button is clicked, but i don’t want that activity to start…
Usually this code helps in starting an activity
public void onClick(View v) {
if (v==Save)
{
Bundle bundle = new Bundle();
bundle.putStringArrayList("DONE", activeURL);
Intent myIntent = new Intent(Reader2.this, Aggregator.class);
myIntent.putExtra("reader2", activeURL);
startActivity(intent);
}
}
but i just want to pass the array and start another activity.
Can you please help me ?
Thanks in advance.
You can declare you ArrayList as a static one like this,
By doing this you can access your ArrayList from anywhere by
where activity_name is the activity or class in which you declare the static ArrayList