public boolean onCreateOptionsMenu(Menu menu) {
   menu.add(0, START_LIVE_DATA, 0, "Start Live Data");
   menu.add(0, COMMAND_ACTIVITY, 0, "Run Command");
   menu.add(0, STOP_LIVE_DATA, 0, "Stop");
   menu.add(0, SETTINGS, 0, "Settings");
   return true;
 }
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   MenuInflater menuInflater = getMenuInflater();
   menuInflater.inflate(R.menu.main_menu, menu);
   menu.add("添加").setIcon(R.drawable.menu_add);
   menu.add("帮助").setIcon(R.drawable.menu_help);
   menu.add("联系").setIcon(R.drawable.menu_contact);
   return super.onCreateOptionsMenu(
       menu); // To change body of overridden methods use File | Settings | File Templates.
 }
  /**
   * Shows "call via" menu allowing user to selected from multiple providers.
   *
   * @param context the android context
   * @param v the View that will contain the popup menu.
   * @param destination target callee name.
   */
  private static void showCallViaMenu(final Context context, View v, final String destination) {
    PopupMenu popup = new PopupMenu(context, v);

    Menu menu = popup.getMenu();

    Iterator<ProtocolProviderService> registeredProviders =
        AccountUtils.getRegisteredProviders().iterator();

    while (registeredProviders.hasNext()) {
      final ProtocolProviderService provider = registeredProviders.next();
      String accountAddress = provider.getAccountID().getAccountAddress();

      MenuItem menuItem = menu.add(Menu.NONE, Menu.NONE, Menu.NONE, accountAddress);

      menuItem.setOnMenuItemClickListener(
          new MenuItem.OnMenuItemClickListener() {
            public boolean onMenuItemClick(MenuItem item) {
              createCall(context, destination, provider);

              return false;
            }
          });
    }

    popup.show();
  }
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   menu.add(0, 0, 0, getString(R.string.hand_in_label))
       .setIcon(R.drawable.icon_retreive)
       .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
   return true;
 }
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   super.onCreateOptionsMenu(menu);
   final MenuItem item =
       menu.add(0, 1, Menu.NONE, myResource.getResource("menu").getResource("search").getValue());
   item.setOnMenuItemClickListener(this);
   item.setIcon(R.drawable.ic_menu_search);
   return true;
 }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    menu.add(0, SAVE_ID, 0, R.string.menu_save)
        .setIcon(R.drawable.save)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.add(0, LOCK_ID, 0, R.string.menu_item_lock)
        .setIcon(R.drawable.lock)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.add(0, DELETE_ID, 0, R.string.menu_delete)
        .setIcon(R.drawable.delete)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.add(0, SHARE_ID, 0, R.string.menu_share)
        .setIcon(R.drawable.share)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.add(0, SMALLER_ID, 0, R.string.menu_smaller)
        .setIcon(R.drawable.smaller)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.add(0, BIGGER_ID, 0, R.string.menu_bigger)
        .setIcon(R.drawable.bigger)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    return true;
  }
Exemple #7
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   super.onCreateOptionsMenu(menu);
   menu.add(0, CONFIG_ID, 0, R.string.config);
   return true;
 }