I am implementing an onboarding process in an app that has an activity and several fragments (and potential later activities). I get to this activity, let’s call it “SummaryActivity” from my MainActivity. Once I’m in the SummaryActivity, in start my process of entering a phone number, receiving an OTP and all the registration jazz. However, if the user is already registered, I display an AlertDialog saying that the user is registered, and when pressing the OK button I want to restart the entire process.
How is the optimal way to approach this such that I get to my SummaryActivity again, at the beginning, and yet allow the user to press “back” and get to the MainActivity. How do I start a task where there already is an activity (in this case, MainActivity) in the back stack, while the task starts in SummaryActivity? I remember doing this in the past but not sure how.