Android Refresh activity when returns to it

后端 未结 7 1952
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:34

    You should handle the result of activity that you started with "startActivityForResult" in a parent activity in a method:

    @override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
       //...
    }
    

    And depending on result you could just invoke again a code that is responsible for showing the information in your parent activity (may be you put it into onResume() method or like that).

    I would suggest you to move all the logic responsible for information rendering to a separate method. And invoke it after you recieve the result. Instead of restarting your parent activity.

提交回复
热议问题