The first step:
E:\01.prj\pyscrapy\Cet4\res\menu\main.xml
<menu xmlns:android= "Http://schemas.android.com/apk/res/android" >
<item
Android:id= "@+id/action_settings"
android:orderincategory= "100"
Android:showasaction= "Never"
android:title= "@string/action_settings"/>
<item
Android:id= "@+id/action_network"
android:orderincategory= "100"
Android:showasaction= "Never"
android:title= "@string/action_network"/>
</menu>
Step Two:
@Override
public boolean Oncreateoptionsmenu (Menu menu) {
Inflate the menu; This adds items to the action bar if it is present.
Getmenuinflater (). Inflate (R.menu.main, menu);
return true;
}
Step Three:
@Override
public boolean onoptionsitemselected (MenuItem item) {
Switch (Item.getitemid ()) {
Case R.id.action_network:
Final Intent Intent = new Intent (this, networksettingactivity.class);
StartActivity (Intent);
Break
Case R.id.action_settings:
Final Intent Intent = new Intent (this, settingsactivity.class);
StartActivity (Intent);
Break
Default
LOG.E (TAG, "Onoptionsitemselected:invalid MenuItem ID" + string.valueof (Item.getitemid ()));
Break
}
return true;
}
Fourth Step:
Create activity
Andriod Development Add a menu