Reputation: 1369
I have the following scenario:
MainActivity
class launches InputActivity1
using startActivityForResult
with the request code SOME_USER_INPUT
.InputActivity1
lets the user input some data and then passes this data to InputActivity2
using Intent.putExtra
.InputActivity2
the user can input some more data.setResult
and finish
in InputActivity2
, all data the user entered shall be returned to the onActivityResult
method of MainActivity
with the previously specified request code SOME_USER_INPUT
.That is, MainActivity
shall not notice at all that the result comes from InputActivity2
, although it just called InputActivity1
.
How can I do the transition from step 2 to 3? I already tried starting InputActivity2
from InputActivity1
by calling startActivityForResult
with the request code and finish
, but (admittedly as expected) MainActivity
does not receive anything.
Upvotes: 0
Views: 1274
Reputation: 1472
Don't call finish in InputActivity1 after calling startActivity (InputActivity2). Do it only when you get the results from InputActivity2. In that way you can pass the results from InputActivit2 to MainActivitiy.
I guess, you can implement this with One InputActivity with two fragments. Just think.
Upvotes: 1