I have three activities (e.g Activity A, Activity B, Activity C) and Activity A calls Activity B by calling startActivityForResult()
method and then, Activity B calls Activity C.
Activity A should receive a return value from Activity C at onActivityResult()
method finishing Activities C and B.
For expand question, it may need more activity steps (A -> B -> C -> D -> -> ... -> return to A) to get a result and the concept of question is the first activity should receive a return value from last activity at onActivityResult()
method.
Process
- Activity A calls -> Activity B that calls -> Activity C
- Finish activities (B, C) and remain only the Activity A.
- A activity receive a result of C activity at
onActivityResult
method.
How can I do this?
Apply Scenario
- Activity A : is main activity and has a start quiz button and score edit text.
- When click the start button, start the activity B.
- Activity B : shows round 1 quiz and when finish this, continue to next round.
- Activity C : shows round 2 quiz and when finish this, continue to next round.
- Activity D : shows round 3 quiz and when finish this, close B, C, D activity and return total score (round1 + round2 + round3) to A activity.
Activity A should be able to recognize the Activity D finished event, so show a grand total score when finished D.