I have three activities in my android application, and i am trying to get user input data from the first activity and pass it to the third activity while at the same time I launch the second activity which also gets the user input data and will also pass the data to the third activity. any ideas on how i should go about this?
Asked
Active
Viewed 36 times
-1
-
Can you explain in a better way? – Ali Bdeir Sep 16 '16 at 09:35
-
3 activities.....activity 1 takes data to 3rd activity when user clicks button and launches activity 2 sametime ... – Mogomotsi Otsile Sep 16 '16 at 10:08
-
And why would you want to do that? Activity 1 is A, Activity 2 is B, 3 is C. Pass the parameter to B. When you go to C, get the retrieved parameter and pass it to C...? – Ali Bdeir Sep 16 '16 at 10:24
-
do you fixed ?. – Swaminathan V Sep 16 '16 at 10:37
-
You can't pass data to some 3rd Activity, then start a 2nd activity and just expect that data to be sitting in the 3rd Activity whenever you want to use it – OneCricketeer Sep 16 '16 at 11:14
-
Possible duplicate of [How do I pass data between activities on Android?](http://stackoverflow.com/questions/2091465/how-do-i-pass-data-between-activities-on-android) – OneCricketeer Sep 16 '16 at 11:15
1 Answers
1
The Way of passing data from Intent is shown below, try passing data same way from ActivityOne -> ActvityTwo -> ActivityThree.
Intent intent = new Intent(ActivityOne.this, ActivityTwo.class);
intent.putExtra("some_key_from_one", some_value_from_one);
startActivity(intent);
Then in the new Activity, retrieve those values:
Bundle extras = getIntent().getExtras();
if (extras != null) {
String value = extras.getString("some_key_from_one");
//The key argument here must match that used in the other activity
}

W4R10CK
- 5,502
- 2
- 19
- 30