Q:

how to update activity method in fragment screen android?

I have method in fragment activity and if that method trigger, I need to update fragment listView. I am dealing with database. Where I am clearing the database of particular user and i will update fragment.
Problem is: if user is in same screen means, how to update fragment listview if fragment activity method triggers? It only works when I need to go back to activity and once again need to come to same screen.
Here is code:
public class ActivityExpertDasboard extends ActivityBase {

     // this method is calling when particular user closes the screen. when I am in fragment screen..
    @Override
    protected void onChatInvitation(String msgKeys, String userId) {
        String msgKey = mApplication.returnEmptyStringIfNull(msgKeys);
        LogMessage.e("username",   mPreference.getStringFromPreference(Constants.CLOSE_CHAT_USERNAME));
        if (userId.equalsIgnoreCase(mPreference.getStringFromPreference(Constants.CLOSE_CHAT_USERNAME))) {
            if (msgKey.equalsIgnoreCase(Constants.CODE_CHAT_END)) {
                AAEDatabaseHelper.deleteUsername(mPreference.getStringFromPreference(Constants.CLOSE_CHAT_USERNAME));
                // I need to update in Fragment screen if this is triggered.
                }
        }
        super.onChatInvitation(msgKey, userId);
    }
}

FragmentExpertLiveChats:
public class FragmentExpertLiveChats extends Fragment {

    private List<LiveChatDetails> list;

     @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_chat_history, container,
                Constants.ATTACH_TO_ROOT);
     list = AAEDatabaseHelper.getLiveChatDetails(Constants.TABLE_LIVE_CHAT);
    }

    @Override
    public void onStart() {
        LogMessage.e("onStart", "onStart");
        super.onStart();
        updateUI();
    }

}

If phone is in FragmentExpertLiveChat screen without doing any perfomance and if method in activity calls, how to update the row? I need to use broadcast receiver? If yes, where and how? 

A:

For that, and many more cases, where you need to communicate amongst different components, I suggest using EventBus. It's usage is very simple:

Define events: public class MessageEvent { /* Additional fields if
  needed */ }
Prepare subscribers Register your subscriber (in your onCreate or in a
  constructor): eventBus.register(this);

Declare your subscribing method: @Subscribe public void
  onEvent(AnyEventType event) {/* Do something */};

Post events: eventBus.post(event);

Don't forget to unregister afterwards. I suggest you do registration/unregistration in start/stop or pause/resume, or, in case of fragments, attach/dettach.
In your case, register in Fragment, and in Activity, when user does his things, post event.

