I have an ActivityA and an ActivityB (in a library module). I navigate from ActivityA to ActivityB via startActivity().
Inside ActivityB I have a NavHost and a Composable which is resolving a deeplink.
When I press back, I have the ActivityA in the back stack but when I launch the ActivityB via a deep link URI, ActivityA in the backstack seems to have destroyed(printed onDestroy to confirm it) since the back stack is empty when I press back from ActivityB, the application closes.
Both Activity A & B has the launch mode as SingleTask. Any help in understanding why ActivityA is getting destroyed is deeply appreciated.
Flow 1
startActivity(Intent
(this,ActivityB::class.java))
startActivity() backpress()
ActivityA ------------------> ActivityB -----------> ActivityA
Flow 2
val intent = Intent()
intent.data = "activityB://test"
startActivity(intent)
via URI (deeplink) backpress()
ActivityA --------------------> ActivityB -------------> Closes application
|
|
|
------>ActivityA
destroyed