Question: =+ public void onClick(View view) { Intent i = new Intent(com.jfdimarzio.passingdata.SecondActivity); //---use putExtra() to add new name/value pairs--- i.putExtra(str1, This is a string); i.putExtra(age1, 25);

=+ public void onClick(View view) {

Intent i = new Intent("com.jfdimarzio.passingdata.SecondActivity");

//---use putExtra() to add new name/value pairs---

i.putExtra("str1", "This is a string");

i.putExtra("age1", 25);

//---use a Bundle object to add new name/values

// pairs---

Bundle extras = new Bundle();

extras.putString("str2", "This is another string");

extras.putInt("age2", 35);

//---attach the Bundle object to the Intent object---

i.putExtras(extras);

//---start the activity to get a result back---

startActivityForResult(i, 1);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Implementing Programming Languages Questions!