Android Refresh activity when returns to it

后端 未结 7 1953
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:20

    Another tricky way to do this is just start your activity on onRestart()

    @Override
    public void onRestart(){
        super.onRestart();
        Intent previewMessage = new Intent(StampiiStore.this, StampiiStore.class);
        TabGroupActivity parentActivity = (TabGroupActivity)getParent();
        parentActivity.startChildActivity("StampiiStore", previewMessage);
        this.finish();
    }
    

    That should do the trick actually. (In this code I'm showing the way it's done when you are using a custom TabActivity manager.)

提交回复
热议问题