0

I saw many threads similar to this. But my scenario is different. This is my Activity flow

Activity A -> Activity A (optional)('n' times) -> Activity B -> Activity C

When I click a button in Activity C, I have to go back to First Activity A closing all others on top of it and perform a task there. When I click back button this flow should not be disturbed. I cannot use any android:launchmode except standard for my scenario. How can I achieve this?

joao2fast4u
  • 6,868
  • 5
  • 28
  • 42
LoveMeSomeFood
  • 3,137
  • 7
  • 30
  • 53

1 Answers1

0

Maybe you can create a boolean instance variable which stores whether an instance of A is first or not. Than in your onActivityResult method:

protected void onActivityResult(int requestCode, int resultCode,
         Intent data) {
         if (resultCode == PREVIOUS_CLOSED && !mFirst) {
             setResult(PREVIOUS_CLOSED);
             finish();                
         }

}
WonderCsabo
  • 11,947
  • 13
  • 63
  • 105