I have an android application where there are 3 activities:
MA – MainActivity (Launched when the application is started)
AC1 – Activity1 – declared as androidLaunchMode=”singleInstance”
AC2- Activity2- declared as androidLaunchMode=”singleInstance”
Initial flow of activities is
MA -> AC1
Go back to MA
MA -> AC2
So the total flow is like MA -> AC1 -> MA -> AC2
Now when I press back I want the flow to be
AC2 -> MA to close application.
So, on back press of MA I want to clear the back stack of activities.
So, how to I handle this in onKeyDown() of MA?
While you are calling MA from AC1 put below flag as intent
and