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 sou开发者_Python百科rce 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!
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.
精彩评论