Example usage for android.support.v4.app SupportActivity invalidateOptionsMenu

List of usage examples for android.support.v4.app SupportActivity invalidateOptionsMenu

Introduction

In this page you can find the example usage for android.support.v4.app SupportActivity invalidateOptionsMenu.

Prototype

void invalidateOptionsMenu();

Source Link

Usage

From source file:com.abcvoipsip.ui.calllog.CallLogListFragment.java

@Override
public void onVisibilityChanged(boolean visible) {
    if (mShowOptionsMenu != visible) {
        mShowOptionsMenu = visible;//from   w  w  w  . ja va2 s  .c  om
        // Invalidate the options menu since we are changing the list of
        // options shown in it.
        SupportActivity activity = getSupportActivity();
        if (activity != null) {
            activity.invalidateOptionsMenu();
        }
    }
    if (visible && isResumed()) {
        getLoaderManager().restartLoader(0, null, this);
        ListView lv = getListView();
        if (lv != null && mAdapter != null) {
            final int checkedPos = lv.getCheckedItemPosition();
            if (checkedPos >= 0) {
                // TODO post instead
                Thread t = new Thread() {
                    public void run() {
                        final long[] selectedIds = mAdapter.getCallIdsAtPosition(checkedPos);
                        getActivity().runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                viewDetails(checkedPos, selectedIds);
                            }
                        });
                    };
                };
                t.start();
            }
        }
    }
}