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.pacoapp.paco.ui.OptionsMenu.java

public boolean init(Menu menu) {
    menu.add(0, PAGING_ITEM, 0, R.string.edit_schedule_menu_item);
    menu.add(0, STOP_ITEM, 1, R.string.stop_experiment_menu_item);
    menu.add(0, DATA_ITEM, 2, R.string.explore_data_menu_item);
    menu.add(0, HELP_ITEM, 3, R.string.about_paco_menu_item);

    return true;/*w w  w .j av  a  2s  .c  om*/
}

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

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.add(Menu.NONE, MENU_SAVE, Menu.NONE, R.string.menu_save_changes)
            .setIcon(android.R.drawable.ic_menu_save).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.whitebyte.hotspotcontrolexample.Main.java

public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(0, 0, 0, "Get Clients");
    menu.add(0, 1, 0, "Open AP");
    menu.add(0, 2, 0, "Close AP");
    menu.add(0, 3, 0, "Search Networks");
    return super.onCreateOptionsMenu(menu);
}

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

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.add(Menu.NONE, MENU_RUN, Menu.NONE, R.string.checkconf_menu_run_check)
            .setIcon(android.R.drawable.ic_media_play).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.commonsware.android.loader.ConstantsBrowser.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(Menu.NONE, ADD_ID, Menu.NONE, "Add").setIcon(R.drawable.add).setAlphabeticShortcut('a');

    return (super.onCreateOptionsMenu(menu));
}

From source file:com.geecko.QuickLyric.utils.CustomSelectionCallback.java

@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    changeThemeColors(true);/*from   ww  w. j a  v  a 2s .  c om*/
    menu.add(0, 9876, 9, R.string.share);
    menu.findItem(9876).setIcon(R.drawable.ic_menu_share);
    menu.findItem(9876).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            View focus = mActivity.getCurrentFocus();
            if (focus instanceof TextView) {
                CharSequence selection = ((TextView) focus).getText().subSequence(
                        ((TextView) focus).getSelectionStart(), ((TextView) focus).getSelectionEnd());
                final Intent sendIntent = new Intent();
                sendIntent.setAction(Intent.ACTION_SEND);
                sendIntent.setType("text/plain");
                sendIntent.putExtra(Intent.EXTRA_TEXT, selection.toString());
                mActivity.startActivity(Intent.createChooser(sendIntent, mActivity.getString(R.string.share)));
                return true;
            }
            return false;
        }
    });
    return true;
}

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

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.add(Menu.NONE, MENU_RUN, Menu.NONE, R.string.menu_run_command)
            .setIcon(android.R.drawable.ic_media_play).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.example.energospolitis.ReportListActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(1, 1, 0, "");

    return true;
}

From source file:edu.mit.collaborativewhiteboard.EditorActivity.java

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

From source file:gov.wa.wsdot.android.wsdot.ui.FerriesRouteSchedulesDaySailingsActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem menuItem_Star = menu.add(0, MENU_ITEM_STAR, menu.size(), R.string.description_star);
    MenuItemCompat.setShowAsAction(menuItem_Star, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);

    if (mIsStarred) {
        menu.getItem(MENU_ITEM_STAR).setIcon(R.drawable.ic_menu_star_on);
    } else {//from   ww  w.jav a2  s.c o m
        menu.getItem(MENU_ITEM_STAR).setIcon(R.drawable.ic_menu_star);
    }

    return super.onCreateOptionsMenu(menu);
}