Exemplo n.º 1
0
  /** Adds an item to the menu. The other add methods funnel to this. */
  private MenuItem addInternal(int group, int id, int categoryOrder, CharSequence title) {
    final int ordering = getOrdering(categoryOrder);

    final MenuItemImpl item =
        new MenuItemImpl(this, group, id, categoryOrder, ordering, title, mDefaultShowAsAction);

    if (mCurrentMenuInfo != null) {
      // Pass along the current menu info
      item.setMenuInfo(mCurrentMenuInfo);
    }

    mItems.add(findInsertIndex(mItems, ordering), item);
    onItemsChanged(true);

    return item;
  }