send data from class to activity android code example

Example 1: android pass object to activity

Intent intent = new Intent(fromClass.this,toClass.class).putExtra("myCustomerObj",customerObj);

Example 2: android studio send multiple data to activity

2

Intent requestLink = new Intent(Search.this, Results.class);
requestLink.putExtra("Link1", sendLink1);
requestLink.putExtra("Link2", sendLink2);
startActivity(requestLink);

//Second Activity 

Bundle bundle=getIntent().getExtras();
String Link1 =bundle.getString("Link1");
String Link2 =bundle.getString("Link2");

Tags:

Misc Example