I am working on a little app and needed a way of making it so when a button is pushed it opens up a random activity, and then doesn't open up that activity again.
I did this by making an ArrayList which is randomly sorted and has a number chosen from it. This number is then deleted. The number chosen is then used to open up one of the activities.
However, when I get to another activity I cannot use the same ArrayList from before (with all the same numbers in).
Is there a way to move the ArrayList from activity to activity?
Thanks in advance!
Here is my code for making the ArrayList and picking a number:
int min = 1;
int max = 3;
ArrayList<Integer> list = new ArrayList<Integer>();
for(int i = min; i <= max; i++) list.add(i);
Collections.shuffle(list);
Integer x = list.get(0);
list.remove(0);