How to update listview when back pressed from another activity android?

First write below method in Adapter

    public void updateList(List<Messages> mChatDetails) {
    this.mChatDetails.clear();
    this.mChatDetails.addAll(mChatDetails)
}

In resume fetch the data from database and call updateList(List mChatDetails) method then call notifyDatasetChanged()

    @Override
public void onResume() {
    // fetch updated data
    adapter.updateList(mChatDetails);
    adapter.notifyDataSetChanged();
}