I am using 2 activities , when i click the button on the first activity it goes to the second activity but how to get data from first activity and do some calculations , display the obtained results in the second activity? Help me I am stuck.!
Asked
Active
Viewed 231 times
2 Answers
1
Intent intent = new Intent(FirstActivity, DetailActivity.class);
intent.putExtra("thingtoPass", itemId);
startActivity(intent);

user3340677
- 177
- 1
- 4
1
In Your First Activity
Intent intent = new Intent(this, SecondActivity.class);
String message = "hello";
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
In Your second Activity
Intent intent = getIntent();
String message = intent.getStringExtra(FirstActivity.EXTRA_MESSAGE);

Praveena
- 6,340
- 2
- 40
- 53