How to use IntentCompat.makeRestartActivityTask()?

前端 未结 3 577
抹茶落季
抹茶落季 2021-01-04 10:58

I\'m trying to implement a button that will result in my app going back to the first activity and acting as if it was (almost) restarted all over. This code

         


        
3条回答
  •  温柔的废话
    2021-01-04 11:50

    Update

    Google has removed the method IntentCompat.makeRestartActivityTask() in current support library versions. Instead, you can just use the plain Android API:

    ComponentName cn = intent.getComponent();
    Intent.makeRestartActivityTask(cn);
    

    I hope this can save someone time searching for alternatives ;)

提交回复
热议问题