I have a MainActivity
where I start (via button click) another second activity:
val intent = Intent(activity, SecondActivity::class.java)
startActivity(intent)
In that SecondActivity
I inflate a SecondFragment
.
When I:
- Tap button to start
SecondActivity
- Automatically, in its onCreate()
SecondFragment
is inflated - When I want to go back to MainActivity by tapping back button, I get a white blank screen (I guess it deflates SecondFragment, but SecondActivity still running?!).
- I have to press back button another second time, to actually go back to
MainActivity
How can go from SecondFragment (--> SecondActivity) --> MainActivity with pressing just once?