Clear all activities in a task?

后端 未结 7 1559
有刺的猬
有刺的猬 2020-11-30 01:44

I have a splash screen activity, then a login activity. My history stack looks like:

SplashActivity
LoginActivity

when the user successfull

7条回答
  •  感动是毒
    2020-11-30 02:28

    Just do this to clear all previous activity in a task:

    finishAffinity() // if you are in fragment use activity.finishAffinity()
    Intent intent = new Intent(this, DestActivity.class); // with all flags you want
    startActivity(intent)
    

提交回复
热议问题