M Jesse M Jesse - 2 years ago 111
Android Question

Android: Detect when an activity returns to the previous activity

I have activity A with a listView, a user clicks on any item which starts Activity B. Depending on what the user does in activity B may change the listView on activity A.

So my question:

How can I tell activity A that it was resumed when the user returns to it from activity B?

I want to be able to signal a refresh of the listView in activity A when it is returned to.


Answer Source

You can add the code to refresh listview in the onResume() of Activity A.

protected void onResume() {
    //Code to refresh listview
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download