YesOne and only one ContextMenu can be created. Check whether the mouse is long-pressed Based on view. Therefore, the number of views in an activity can be as many as the number of contextmenus.
SetContentView (R. layout. pure_text );
RegisterForContextMenu(InfoTv );
}
Public void onCreateContextMenu (ContextMenu menu, View v, ContextMenuInfo menuInfo){
Menu.SetHeaderIcon(R. drawable. leaf );
Menu.SetHeaderTitle("Context Menu :");
Menu.Add(Menu. NONE,, TV _CONTEXTMENU_BASE, "Item.1 ");
Menu.Add(Menu. NONE, TV _CONTEXTMENU_BASE + 1,, "Item.2 ");
SubMenu. setHeaderIcon (R. drawable. clock );
SubMenu. add (Menu. NONE, TV _CONTEXTMENU_BASE + 100, + TV _CONTEXTMENU_BASE + 100, "sub.1 ");
SubMenu. add (Menu. NONE, TV _CONTEXTMENU_BASE + 101, + TV _CONTEXTMENU_BASE + 101, "sub.2 ");
}
Public boolean onContextItemSelected (MenuItem item){
If (Item. getItemId ()= TV _CONTEXTMENU_BASE ){
} Else {
}
Return super. onContextItemSelected (item );
}