BRDroid
BRDroid

Reputation: 4388

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
        )
    )

Upvotes: 0

Views: 590

Answers (2)

Tenfour04
Tenfour04

Reputation: 93629

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()

Upvotes: 2

AhmetAcikalin
AhmetAcikalin

Reputation: 326

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()
    }

Upvotes: 0

Related Questions