2

Possible Duplicate:
How do I pass data between activities in Android?

I have two activities. One with text and image views and the other with a button.

I would like to click the button on the activity, go to the second activity and set the text and images of that second activity.

Can anyone give me any help?

Community
  • 1
  • 1
cnfw
  • 718
  • 2
  • 11
  • 28

1 Answers1

3

1. Use Intent.

2. For Keeping it simple you can use PutExtra() to send the data to another activity with the intent, and can get the data on the another activity by using getExtras()

3. You can also use startActivityforResult() for the same purpose.

/////////////Edited//////////

Eg:

In Activity Class_One

Intent i = new Intent(Class_One.this , Class_Two.class);
i.putExtra("Name", name);
startActivity(i);

In Activity Class_Two

Intent i = getIntent();
String name = i.getExtras().getString("Name");
Kumar Vivek Mitra
  • 32,278
  • 6
  • 43
  • 74