Restarting Android app programmatically

前端 未结 9 2008
独厮守ぢ
独厮守ぢ 2021-02-03 12:14

This is a follow up question to this question:

Force application to restart on first activity

I am trying to restart my application from a fragment like that:

9条回答
  •  余生分开走
    2021-02-03 12:51

    Please refer below code

        Intent intent = new Intent(this, YourHomeActivity.class);
        this.startActivity(intent);
        this.finishAffinity();
    

    It is starting your home activity and dismiss all other activities. It looks like a restart to users, but the process is the same.

提交回复
热议问题