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.commonsware.android.arXiv.ArticleList.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(Menu.NONE, INCREASE_ID, Menu.NONE, "Increase Font");
    menu.add(Menu.NONE, DECREASE_ID, Menu.NONE, "Decrease Font");
    if (!favorite)
        menu.add(Menu.NONE, FAVORITE_ID, Menu.NONE, "Add to Favorites");
    return true;//  ww  w .  j a v  a2s  .  co m
}

From source file:gxu.software_engineering.market.android.ui.UsersFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem populateItem = menu.add(Menu.NONE, 1, 0, "Populate");
    MenuItemCompat.setShowAsAction(populateItem, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    MenuItem clearItem = menu.add(Menu.NONE, 2, 0, "Clear");
    MenuItemCompat.setShowAsAction(clearItem, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
}

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

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem item = menu.add(Menu.NONE, Menu.FIRST, Menu.NONE, R.string.actions)
            .setIcon(R.drawable.abc_ic_menu_moreoverflow_mtrl_alpha);
    MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    return super.onCreateOptionsMenu(menu);
}

From source file:id.ridon.keude.SearchResults.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    super.onCreateOptionsMenu(menu);
    MenuItem search = menu.add(Menu.NONE, SEARCH, 1, R.string.menu_search)
            .setIcon(android.R.drawable.ic_menu_search);
    MenuItemCompat.setShowAsAction(search, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    return true;/*from  w w w.java2s  .  c  o m*/
}

From source file:org.alfresco.mobile.android.application.fragments.activitystream.ActivityFeedAdapter.java

public void getMenu(Menu menu, ActivityEntry entry) {
    if (entry.getCreatedBy() != null) {
        menu.add(Menu.NONE, R.id.menu_activity_profile, Menu.FIRST,
                String.format(getContext().getString(R.string.activity_profile), entry.getCreatedBy()));
    }//from w ww  .j  a  v  a 2 s  . c o m
}

From source file:cz.msebera.unbound.dns.fragments.MainLogFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.add(Menu.NONE, MENU_CLEAR, Menu.NONE, R.string.menu_clear)
            .setIcon(android.R.drawable.ic_menu_close_clear_cancel)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    menu.add(Menu.NONE, MENU_EMPTY, Menu.NONE, R.string.mainlog_menu_truncate_log)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.madgag.android.lazydrawables.samples.DemoListActivity.java

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

    menu.add(0, CLEAR_STORAGE_ID, 0, "Clear image storage").setShortcut('0', 'c').setIcon(ic_menu_delete);

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

From source file:com.support.android.designlibdemo.data.maps.MapActivity.java

/**********************************************************************************************/

@Override/*  w  w  w. java2s  .  co m*/
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(0, 0, 0, "LISTO").setIcon(R.drawable.ic_check_white_24dp)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    return true;
}

From source file:com.bellman.bible.android.view.activity.base.actionbar.QuickActionButton.java

public void addToMenu(Menu menu) {
    if (menuItem == null || (menu.findItem(thisItemId) == null)) {
        menuItem = menu.add(Menu.NONE, thisItemId, Menu.NONE, "");
        MenuItemCompat.setShowAsAction(menuItem, showAsActionFlags);
        menuItem.setOnMenuItemClickListener(this);
        update(menuItem);//from  www . j a  va 2 s  .c o  m
    }
}

From source file:net.lacolaco.smileessence.activity.EditCommandActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem allOn = menu.add(Menu.NONE, R.id.menu_edit_command_all_on, Menu.NONE, "");
    allOn.setTitle(R.string.actionbar_edit_command_all_on);
    allOn.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    return true;/*ww  w.  j  a v a2 s  . co  m*/
}