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:fr.umlv.lastproject.smart.browser.FileChooserActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_smart, menu);
    menu.add(0, 1, 0, R.string.directory);

    return true;/*w w  w  .  ja  v a  2  s  .c  om*/
}

From source file:com.pansapiens.occyd.MapResults.java

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

    // group, id (for click handling), order, title
    int order = Menu.CATEGORY_CONTAINER + Menu.FLAG_ALWAYS_PERFORM_CLOSE;
    menu.add(Menu.NONE, 0, order, "Search").setAlphabeticShortcut('s');
    ;/* w  w w.ja  va 2s. c o  m*/
    menu.add(Menu.NONE, 1, order, "Post").setAlphabeticShortcut('p');
    ;
    menu.add(Menu.NONE, 2, order, "Map").setAlphabeticShortcut('m');
    menu.add(Menu.NONE, 3, order, "Settings");
    menu.add(Menu.NONE, 4, order, "Help").setAlphabeticShortcut('h');
    return true;
}

From source file:com.miz.mizuu.fragments.CollectionCoverSearchFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    for (int i = 0; i < mItems.length; i++)
        menu.add(0, i, i, mItems[i]);
    menu.setGroupCheckable(0, true, true);

    super.onCreateOptionsMenu(menu, inflater);
}

From source file:eu.thecoder4.gpl.pleftdroid.PleftDroidActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(0, CREATE_ID, 0, R.string.menu_create).setIcon(android.R.drawable.ic_menu_my_calendar);
    menu.add(0, PREFS_ID, 0, R.string.menu_prefs).setIcon(android.R.drawable.ic_menu_preferences);
    menu.add(0, ABOUT_ID, 0, R.string.menu_about).setIcon(android.R.drawable.ic_menu_info_details);

    return super.onCreateOptionsMenu(menu);
}

From source file:com.example.office365sample.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);

    menu.add(Menu.NONE, MENU_RESET_TOKEN, Menu.NONE, "Clear Token Cache");
    menu.add(Menu.NONE, MENU_LOGIN, Menu.NONE, "Login");
    menu.add(Menu.NONE, MENU_READ_MESSAGES, Menu.NONE, "Read Messages");
    return true;/*from w w w  .ja  va  2  s.  c o m*/
}

From source file:com.greenkee.pokeADot.GameActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    menu.add(0, MENU_BUTTON_1, 0, getString(com.greenkee.pokeADot.R.string.reset_title));
    menu.add(0, MENU_BUTTON_3, 0, getString(com.greenkee.pokeADot.R.string.pause_title));
    menu.add(0, MENU_BUTTON_2, 0, getString(com.greenkee.pokeADot.R.string.settings_title));

    return true;//  w ww  .  j  a va2  s  .  c o  m
}

From source file:net.reichholf.dreamdroid.abstivities.AbstractHttpActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    menu.add(0, MENU_HOME, 99, getText(R.string.home)).setIcon(android.R.drawable.ic_menu_view);
    return true;/* w  w  w . ja v a  2 s. c o m*/
}

From source file:com.activiti.android.app.fragments.HelpDialogFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    menu.clear();//w  w w.  j  a v  a 2 s.c om

    refreshIcon = menu.add(Menu.NONE, R.id.menu_refresh, Menu.FIRST, R.string.refresh);
    refreshIcon.setIcon(R.drawable.ic_refresh_white);
    refreshIcon.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}

From source file:cn.androidy.materialdesignsample.animations.CardFlipActivity.java

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

    // Add either a "photo" or "finish" button to the action bar, depending on which page
    // is currently selected.
    MenuItem item = menu.add(Menu.NONE, R.id.action_flip, Menu.NONE,
            mShowingBack ? R.string.action_photo : R.string.action_info);
    item.setIcon(mShowingBack ? R.drawable.ic_action_photo : R.drawable.ic_action_info);
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    return true;/*  www.jav  a 2 s  . c om*/
}

From source file:com.zyq.uitoucheventtest.animator.CardFlipActivity.java

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

    // Add either a "photo" or "finish" button to the action bar, depending on which page
    // is currently selected.
    MenuItem item = menu.add(Menu.NONE, R.id.action_flip, Menu.NONE,
            mShowingBack ? R.string.action_photo : R.string.action_info);
    item.setIcon(mShowingBack ? R.mipmap.ic_action_photo : R.mipmap.ic_action_info);
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    return true;//from   w  w  w .j  a va  2  s .co m
}