There is an application with 2 active. In the first - one button called Menu number one. You press, you get into the second activation, and in the onCreate method, a onCreate is executed.
public class Main2Activity extends Activity implements View.OnClickListener{ public ArrayList<Integer> Arrayl; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); Button b2 = (Button)findViewById(R.id.button2); b2.setOnClickListener(this); Arrayl = new ArrayList<>(); for (int a = 1; a < 8; a++) { Arrayl.add(a); } Collections.shuffle(Arrayl);// перемешиваем Log.d("","ТУТ:" +Arrayl.toString()); } @Override public void onClick(View v) { Intent gotoanotheractivity = new Intent(Main2Activity.this, MainActivity.class); startActivity(gotoanotheractivity); } } Further, you press the Main menu button and you get back to the first activation, where there is the Menu number one button.
So, the task : when I go into the second activation the second time, the following cycle should be executed:
Arrayl = new ArrayList<>(); for (int a = 8; a < 25; a++) { Arrayl.add(a); } Collections.shuffle(Arrayl);// перемешиваем Log.d("","ТУТ:" +Arrayl.toString()); Tell me, even an idea how this can be done?