Running multiple actions in a chain
Hi Android developers.
I have three activities that are triggered in some kind of chain.
Activity A -> has a trigger button that triggers activity B.
Activity B -> Cancel, which goes back to Activity A. And a capture button, which launches Activity C with some data.
Activity C -> back button that goes back to activity B which should resume activity A with some data.
My question is the correct way to start these activities in the chain and how can I keep the flow from Activity C to A.
source to share
Activity A -> has a trigger button that triggers activity B.
Start a new activity like
Intent myIntent = new Intent(A.this, B.class);
startActivityForResult(myIntent);
Activity B -> a cancel button that reverts back to Activity A. And a capture button that starts Activity C with some data.
In undo mode you can just call finish()
, and on the capture button you can start a new activity C.
Action C -> back button which falls back to using activity B, which should resume activity A with some data.
on the return button you can call finish()
and if you want to get any input from Activity A then you should call StartActivityForResult(1212)
and get this code to onActivityResult
do the operation you want and end () Action A when you do it it will be automatically redirected to Activity C, in Activity C onResume()
you will be able to get this data value.
source to share