tags:

views:

28

answers:

2

who knows about the method "add" in menu interface? how to implement exactly? which is it's imlementation class? i couldn't find detail implementation in source code of sdk. i want to check how to implement in android source code for "add" method.

e.g.

public boolean onCreateOptionsMenu(Menu menu) {
    menu.***add***(0, MENU_NEW_GAME, 0, "New Game");
    menu.add(0, MENU_QUIT, 0, "Quit");
    return true;
}

thanks in advance!

+1  A: 

public abstract MenuItem add (int groupId, int itemId, int order, CharSequence title) Since: API Level 1 Add a new item to the menu. This item displays the given title for its label.

Parameters::

groupId The group identifier that this item should be part of. This can be used to define groups of items for batch state changes. Normally use NONE if an item should not be in a group.

itemId Unique item ID. Use NONE if you do not need a unique ID.

order The order for the item. Use NONE if you do not care about the order. See getOrder().

title The text to display for the item.

Returns The newly added menu item.

Jorgesys
A: 

thanks! since this method is a abstract method, so i just want to find implementation source code for add method. which class implement this method? what is detail implementation code? generally, a abstract method in interface must have a class implement this interface and override this method.

wsgjj
noone knows about it?
wsgjj