Code example for Menu

Methods: add

0
    } 
 
    /** Called when the menubar is being created by Android. */ 
    public boolean onCreateOptionsMenu(Menu menu) {
        Log.i(TAG, "onCreateOptionsMenu");
        mMenuSketch = menu.add("Sketch or Painting");
        mMenuAlien = menu.add("Alien or Human");
        mMenuEvil = menu.add("Evil or Good");
        mMenuDebug = menu.add("[Debug mode]");
        return true; 
    } 
 
    /** Called whenever the user pressed a menu item in the menubar. */ 
    public boolean onOptionsItemSelected(MenuItem item) {
        Log.i(TAG, "Menu Item selected: " + item);
        if (item == mMenuSketch)
            mView.toggleSketchMode();
        else if (item == mMenuAlien)
            mView.toggleAlienMode();
        else if (item == mMenuEvil)
            mView.toggleEvilMode();