Lets assume a scenario such below and in this scenario every letter points an activity, every number within parenthesis points opening time and every arrow points a transition from one to another
A(1) -> B(1) -> A(2) (meaning A is opened then B is opened and A is opened again)
if I press back button A tries to open itself again
A(1) -> B(1) -> A(2) -> B(2) -> A(3) -> C(1) -> A(4)
at this point if I press back button I tries to open itself 4 times again. What I expect is at least it should open C(1) then A(3) then B(2) then A(2) ...
the problem goes by changing the launchmode to singleInstance but I don't understand why this is happening? This is the first time that I'm facing an issue like this.
<activity
android:name="ProfileActivity"
android:theme="@style/NoActionBarTheme">
</activity>
and I'm calling it like below
fun launchProfileActivity(context: Activity) {
context.startActivity(
Intent(context, ProfileActivity::class.java))
}