Code example for Menu

Methods: add

    /** 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)
        else if (item == mMenuAlien)
        else if (item == mMenuEvil)
Experience pair programming with AI  Get Codota for Java