I have one activity A, that has one button and one list view which shows names of books . on click of the button, activity B starts, there user fill the book form and save it . when he press back button , user comes to activity A. Here the book name should be updated in listview. I think I have to write some code in onResume() . Can u please tell me what to write. I am using customised list view.
Share
Start activity B with
startActivityForResult()and use methodonActivityResult()to restart or process the new dataFor example, to start Activity B:
Then somewhere in your Activity A class:
The other answers should suffice, but onResume() can be called in cases where the activity is resumed by other means.
To simply restart Activity A when user presses back button from Activity B, then put the following inside the onActivityResult:
And in the onCreate of Activity A, add
starterintent = getIntent();Just remember to initiate the variable with
Intent starterintent;somewhere before your onCreate is called.e.g.
Then just call
startActivityB()from a button click or whatever