Android Refresh activity when returns to it

后端 未结 7 1947
Happy的楠姐
Happy的楠姐 2021-02-07 10:41

I need a little help with refreshing one of my activities in my application. I\'m using tab host activity and connecting to web service and downloading some data from one of my

7条回答
  •  感情败类
    2021-02-07 11:18

    Override the

    onRestart()

    method so that it is called automatically when you return back from your desired task.

    Put the following code in your onRestart() method :

    @Override
    protected void onRestart() {
        super.onRestart();
        finish();
        overridePendingTransition(0, 0);
        startActivity(getIntent());
        overridePendingTransition(0, 0);
    }
    

提交回复
热议问题