Removing an activity from the history stack

后端 未结 15 1179
[愿得一人]
[愿得一人] 2020-11-22 08:28

My app shows a signup activity the first time the user runs the app, looks like:

  1. ActivitySplashScreen (welcome to game, sign up for an account?)
  2. Activ
15条回答
  •  無奈伤痛
    2020-11-22 09:05

    Removing a activity from a History is done By setting the flag before the activity You Don't want

    A->B->C->D

    Suppose A,B,C and D are 4 Activities if you want to clear B and C then set flag

    intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    

    In the activity A and B

    Here is the code bit

    Intent intent = new Intent(this,Activity_B.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    startActivity(intent);
    

提交回复
热议问题