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.pepperonas.truthordare.fragments.FragmentTwoPlayer.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    menu.add(0, 0, 0, "Start").setIcon(R.drawable.ic_marked_circle_white_24dp)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.getItem(0).setOnMenuItemClickListener(this);
}

From source file:com.eTilbudsavis.sdkdemo.CatalogViewer.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(Menu.NONE, MENU_PAGEOVERVIEW, Menu.NONE, "Pageoverview");
    return super.onCreateOptionsMenu(menu);
}

From source file:net.idlesoft.android.apps.github.activities.BranchesList.java

@Override
public boolean onPrepareOptionsMenu(final Menu menu) {
    if (!menu.hasVisibleItems()) {
        menu.add(0, 0, 0, "Back to Main").setIcon(android.R.drawable.ic_menu_revert);
        menu.add(0, 1, 0, "Clear Preferences");
        menu.add(0, 2, 0, "Clear Cache");
    }/*from   w ww.  j a va 2s  . c om*/
    return true;
}

From source file:de.trier.infsec.koch.droidsheep.activities.HijackActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    menu.add(0, 0, 0, getString(R.string.back));
    menu.add(0, 1, 0, getString(R.string.forward));
    menu.add(1, 2, 0, getString(R.string.reload));
    menu.add(1, 3, 0, getString(R.string.close));
    menu.add(1, 4, 0, getString(R.string.changeurl));
    return true;/*  ww w.ja  v a2  s.c  om*/
}

From source file:de.stadtrallye.rallyesoft.fragments.TasksPagerFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem resize = menu.add(Menu.NONE, R.id.resize_menu, 40, R.string.resize);
    resize.setIcon(R.drawable.ic_center_light);
    resize.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}

From source file:com.gh4a.activities.GistActivity.java

public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem starItem = menu.add(0, R.id.star, 0, R.string.repo_star_action).setIcon(R.drawable.star);
    MenuItemCompat.setShowAsAction(starItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);

    if (mGist != null) {
        MenuItem shareItem = menu.add(0, R.id.share, 0, R.string.share).setIcon(R.drawable.social_share);
        MenuItemCompat.setShowAsAction(shareItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    }// ww  w .  jav  a2  s  . c o  m

    return super.onCreateOptionsMenu(menu);
}

From source file:com.rvl.android.getnzb.GetNZB.java

public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(0, MENU_ABOUT, 0, "About");
    menu.add(0, MENU_PREFS, 0, "Preferences");
    menu.add(0, MENU_QUIT, 0, "Quit");
    return true;//from w w w.j  a v  a2 s.co m
}

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

public boolean onPreparePanel(int featureId, View view, Menu menu) {
    menu.clear();//ww  w .  j  a  v a  2 s .co  m
    menu.add(0, SAVE, 0, "Download to SD Card");
    menu.add(0, SET_PROFILE, 0, "Set as Profile");
    //menu.add(1, ANON, 1, "Add anon profile");
    return true;
}

From source file:com.zbrown.droidsteal.activities.HijackActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuItem menu0 = menu.add(0, 0, 0, getString(R.string.back));
    menu0.setIcon(R.drawable.ic_action_back);
    menu0.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    MenuItem menu1 = menu.add(0, 1, 0, getString(R.string.forward));
    menu1.setIcon(R.drawable.ic_action_forward);
    menu1.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    MenuItem menu2 = menu.add(0, 2, 0, getString(R.string.reload));
    menu2.setIcon(R.drawable.ic_action_refresh);
    menu2.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.add(0, 3, 0, getString(R.string.changeurl));
    menu.add(0, 4, 0, getString(R.string.close));
    return true;//from   www.  j  av  a2 s . c o  m
}

From source file:com.fabernovel.alertevoirie.HomeActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(0, MENU_CREDITS, Menu.FIRST, R.string.menu_credits)
            .setIcon(android.R.drawable.ic_menu_info_details);
    return super.onCreateOptionsMenu(menu);
}