first you create an Intent in your function where must bring you to the 2 activity this code is in your first activity, before open the seconde activity example of an onClik event Button
Intent intent = new Intent(this, DashboardActivity2.class);
DashboardActivity2.class is the 2 activity that will open then you need to create an ArrayList to store
all your Items. We can pick this data from others sources as an database or something else, in this case we create an ArrayList and we put in the values manually.
ArrayList<String> cars = new ArrayList<String>();
cars.add(0,"I"); //Item "I" will be at position 0
cars.add(1,"'");
cars.add(2,"m");
cars.add(3,"o");
cars.add(4,"s"); //Here the element N°4 will be "s"
cars.add(5,"l");
cars.add(6,"a");
cars.add(7,"r");
cars.add(8,"C");
cars.add(9," ");
now you need to import our list in to the Intent you created remember i give Intent name as intent, with lower "i", but you can give the name you wish.
intent.putExtra("list",cars);
We give a Key to our List named "list" putExtra("KEY",OBJECT),the Object is our List
startActivity(intent);
Then we can start the new activity by calling the startActivity(intent);
In our seconde activity we get this DATA
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dashboard2);
we have a button to receive the text, this Button was created inside XML connected file to seconde activity
Button button2 =findViewById(R.id.button2);
we create a new Intent i used same name as first Activity but not mandatory, and i said this Intent intent is equal getIntent from first activity, like a Copy I don't Know if more then 1 intent it's possible and how catch them if multiple, i think it's only possible 1 Intent and you can send all resources from one to another activity using it
Intent intent=getIntent();
Then i create a new ArrayList and i give it same name "cars" as in first activity not Mandatory
ArrayList<String> cars = new ArrayList<>();
now we send inside ArrayList "cars" all data from the first activity list by get an StringArrayList because it's an ArrayList we are receiving we using the Object "list" Because it's the Key we have done in the first activity Intent intent
cars= intent.getExtras().getStringArrayList("list");
Then we set Button Text by geting Items in our List, using their Position on the list
button2.setText(cars.get(0).toString()+
cars.get(1).toString()+
cars.get(2).toString()+
cars.get(9).toString()+
cars.get(8).toString()+
cars.get(6).toString()+
cars.get(7).toString()+
cars.get(5).toString()+
cars.get(3).toString()+
cars.get(4).toString()
);
RESULT When OPEN SECOND ACTIVITY