Example usage for android.view Menu add

List of usage examples for android.view Menu add

Introduction

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

Prototype

public MenuItem add(int groupId, int itemId, int order, @StringRes int titleRes);

Source Link

Document

Variation on #add(int,int,int,CharSequence) that takes a string resource identifier instead of the string itself.

Usage

From source file:com.photocitygame.android.ImageActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(0, MENU_CAMERA, 0, "Capture a new image").setIcon(android.R.drawable.ic_menu_camera);
    return true;/*w  w  w .ja va2s  . c  om*/
}

From source file:com.mifos.mifosxdroid.online.DataTableDataFragment.java

@SuppressWarnings("deprecation")
@Override/*ww w.j  av  a 2  s  .c  o m*/
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    MenuItem menuItemAddNewEntryToDataTable = menu.add(Menu.NONE, MEUN_ITEM_ADD_NEW_ENTRY, Menu.NONE,
            getString(R.string.add_new));
    menuItemAddNewEntryToDataTable.setIcon(getResources().getDrawable(R.drawable.ic_action_content_new));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        menuItemAddNewEntryToDataTable.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }
    super.onPrepareOptionsMenu(menu);
}

From source file:com.mifos.mifosxdroid.online.DocumentListFragment.java

@SuppressWarnings("deprecation")
@Override/*  w w  w .  j  av a  2s  . com*/
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    MenuItem menuItemAddNewDocument = menu.add(Menu.NONE, MENU_ITEM_ADD_NEW_DOCUMENT, Menu.NONE,
            getString(R.string.add_new));
    menuItemAddNewDocument.setIcon(getResources().getDrawable(R.drawable.ic_action_content_new));

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        menuItemAddNewDocument.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    super.onPrepareOptionsMenu(menu);
}

From source file:com.android.development.ExceptionBrowser.java

public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    menu.add(0, UPLOAD_ID, 0, R.string.menu_upload_exceptions);
    menu.add(0, CLEAR_ID, 0, R.string.menu_clear_exceptions);

    return true;//from   w w w.j  a va 2 s . c  o m
}

From source file:com.tinfoil.sms.settings.QuickPrefsActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(Menu.NONE, 0, 0, "Show current settings");
    return super.onCreateOptionsMenu(menu);
}

From source file:net.reichholf.dreamdroid.activities.ScreenShotActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(0, ITEM_RELOAD, 0, getText(R.string.reload)).setIcon(android.R.drawable.ic_menu_rotate);
    return true;/* w w  w  .  ja va 2s  .c o m*/
}

From source file:com.idt.ontomedia.geoconsum.BaseActivity.java

@Override
public boolean onCreateOptionsMenu(Menu _menu) {
    if (this instanceof PlaceDetailActivity) {
        _menu.add(0, REPORT_BUG_ITEM_ID, 0, R.string.menu_report_bug_title);
    }//from w  w  w  .j a v a2s .c  o  m
    _menu.add(0, PREFERENCES_ITEM_ID, 1, R.string.menu_preferences_title);
    _menu.add(0, ABOUT_ITEM_ID, 2, R.string.menu_about_title);
    return super.onCreateOptionsMenu(_menu);
}

From source file:com.commonsware.android.arXiv.arXiv.java

private void populateMenu(Menu menu) {
    menu.add(Menu.NONE, ABOUT_ID, Menu.NONE, R.string.about_arxiv_droid);
    menu.add(Menu.NONE, HISTORY_ID, Menu.NONE, R.string.view_history);
    menu.add(Menu.NONE, PREF_ID, Menu.NONE, R.string.preferences);
    menu.add(Menu.NONE, DONATE_ID, Menu.NONE, R.string.donate);
}

From source file:com.commonsware.android.arXiv.arXiv.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(Menu.NONE, SEARCH_ID, Menu.NONE, R.string.search).setIcon(R.drawable.ic_action_action_search)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    populateMenu(menu);/*from  w  w  w. ja v  a 2 s.c  o  m*/
    this.menu = menu;
    return (super.onCreateOptionsMenu(menu));
}

From source file:or.tango.android.activity.PicActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(0, 3, 3, "??");
    return super.onCreateOptionsMenu(menu);
}