These interfaces are interface elements that are often used in development beyond the main interface of the activity,
The Dialog,toast interface can be customized. The interface of Optionmenu and ContextMenu can also be customized, but not dialog so flexible, it can only customize some title,item and the like.
1.dialog Custom Interface
Alertdialog dialog=new Alertdialog.builder (mainactivity.this). Create ();
Dialog.setview (view);
2.toast Custom Interface
Toast toast= Toast.maketext (mainactivity.this, "abc", Toast.length_long);
Toast.setview (New Button (Mainactivity.this));
Toast.show ();
3.optionmenu
How to use
public boolean Oncreateoptionsmenu (menu menu) This function is called only once, and it can be considered a part of the activity life cycle.
public boolean Onprepareoptionsmenu (menu menu) This function is called before the menu is displayed.
public boolean onoptionsitemselected (MenuItem item) is invoked when it chooses to touch an item
4.contextmenu
ContextMenu need registe to use, register to which view, and then long press the view, the framework will callback oncreatecontextmenu this function
This.registerforcontextmenu (TXT2);
ContextMenu is called again before each display Oncreatecontextmenu
public void Oncreatecontextmenu (ContextMenu menu, View v,contextmenuinfo menuinfo)//will be called before each display
public boolean oncontextitemselected (MenuItem Item)
Use of Dialog,toast,optionmenu,contextmenu in Android