Example usage for android.view Menu clear

List of usage examples for android.view Menu clear

Introduction

In this page you can find the example usage for android.view Menu clear.

Prototype

public void clear();

Source Link

Document

Remove all existing items from the menu, leaving it empty as if it had just been created.

Usage

From source file:org.thoughtcrime.securesms.PassphrasePromptActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuInflater inflater = this.getMenuInflater();
    menu.clear();

    inflater.inflate(R.menu.log_submit, menu);
    super.onPrepareOptionsMenu(menu);
    return true;//from   www . ja v  a 2 s.  co m
}

From source file:com.acrylicgoat.devchat.MainActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    getMenuInflater().inflate(R.menu.activity_main, menu);
    readDB();/*from w w  w.  j  av  a 2  s .  c o  m*/
    if (devs != null && devs.size() > 0) {
        for (int i = 0; i < devs.size(); i++) {
            Developer dev = devs.get(i);
            menu.add(0, MENUITEM, 0, dev.getName());

        }
    }
    boolean drawerOpen = drawerLayout.isDrawerOpen(drawerList);
    menu.findItem(R.id.save).setVisible(!drawerOpen);
    return true;
}

From source file:org.libreoffice.impressremote.fragment.ComputerConnectionFragment.java

@Override
public void onCreateOptionsMenu(Menu aMenu, MenuInflater aMenuInflater) {
    if (!shouldActionBarMenuBeDisplayed()) {
        aMenu.clear();
        return;/*from  ww  w  .  j a  va  2 s. c  o  m*/
    }

    aMenuInflater.inflate(R.menu.menu_action_bar_computer_connection, aMenu);
}

From source file:com.rowland.hashtrace.ui.fragments.subfragment.FavouriteListFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    // Clear old menu.
    menu.clear();
    // Inflate new menu.
    inflater.inflate(R.menu.menu_favlistfragment, menu);
}

From source file:com.acrylicgoat.scrumnotes.MainActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    getMenuInflater().inflate(R.menu.activity_main, menu);
    readDB();//w w  w  .  j  ava  2 s . c  o  m
    if (devs != null && devs.size() > 0) {
        for (int i = 0; i < devs.size(); i++) {
            Developer dev = (Developer) devs.get(i);
            menu.add(0, MENUITEM, 0, dev.getName());

        }
    }
    boolean drawerOpen = drawerLayout.isDrawerOpen(drawerList);
    menu.findItem(R.id.save).setVisible(!drawerOpen);
    return true;
}

From source file:org.voidsink.anewjkuapp.activity.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    initActionBar();//from   ww  w.  j a v a 2  s  .  c o  m

    menu.clear();
    getMenuInflater().inflate(R.menu.main, menu);

    return super.onCreateOptionsMenu(menu);
}

From source file:com.cypress.cysmart.DataLoggerFragments.DataLoggerFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.clear();
    inflater.inflate(R.menu.global, menu);
    MenuItem share = menu.findItem(R.id.share);
    MenuItem sharelogger = menu.findItem(R.id.sharelogger);
    MenuItem log = menu.findItem(R.id.log);
    MenuItem search = menu.findItem(R.id.search);
    MenuItem graph = menu.findItem(R.id.graph);
    search.setVisible(false);//from  w  ww  .  java2s .co m
    share.setVisible(false);
    log.setVisible(false);
    graph.setVisible(false);
    sharelogger.setVisible(true);
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.odoo.addons.sale.Sales.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    menu.clear();
    inflater.inflate(R.menu.menu_sales_order, menu);
    setHasSearchView(this, menu, R.id.menu_sales_search);

}

From source file:com.cypress.cysmart.BLEServiceFragments.HealthTemperatureService.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.clear();
    inflater.inflate(R.menu.global, menu);
    ActionBar actionBar = getActivity().getActionBar();
    if (actionBar != null) {
        actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent)));
    }//  ww  w .  j  ava 2s.  co m
    MenuItem graph = menu.findItem(R.id.graph);
    MenuItem log = menu.findItem(R.id.log);
    MenuItem search = menu.findItem(R.id.search);
    search.setVisible(false);
    graph.setVisible(true);
    log.setVisible(true);
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:edu.stanford.mobisocial.dungbeetle.ImageGalleryActivity.java

public boolean onPreparePanel(int featureId, View view, Menu menu) {
    menu.clear();
    menu.add(0, MENU_EDIT, 0, "Edit");
    menu.add(0, MENU_SAVE, 0, "Save to SD Card");
    menu.add(0, MENU_SET_PROFILE, 0, "Set as Profile");
    return true;/*from  ww  w. j  a  v  a2 s .com*/
}