Activity.finishAffinity() vs Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK

前端 未结 4 498
伪装坚强ぢ
伪装坚强ぢ 2021-01-01 11:09

In Android, if you want to clear your current Activity stack and launch a new Activity (for example, logging out of the app and launching a log in

4条回答
  •  醉梦人生
    2021-01-01 11:36

    If API >= 21, you can use the command of:

    finishAndRemoveTask ();

    Finishes all activities in this task and removes it from the recent tasks list.

    https://developer.android.com/reference/android/app/ActivityManager.AppTask.html

提交回复
热议问题