'How can I stop activity being added to backstack
how can I avoid adding an activity to a backstack.
This is how I start an activity
startActivity(
StripeConnectActivity.createIntent(
context = baseContext,
paymentSetupState = paymentSetupState,
setupFlowType = SetupFlowType.STANDARD
)
)
Solution 1:[1]
Simply follow up your call to startActivity() with a finish() call to close the current activity so it won't be in the back stack.
startActivity(
StripeConnectActivity.createIntent(
context = baseContext,
paymentSetupState = paymentSetupState,
setupFlowType = SetupFlowType.STANDARD
)
)
finish()
Solution 2:[2]
Try to set flags to the intent
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK
or you can modify
override fun onBackPressed() {
super.onBackPressed()
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tenfour04 |
| Solution 2 | AhmetAcikalin |
