Code example for SubMenu

Methods: add

0
        // add menu items 
    	 
    	super.onCreateOptionsMenu(menu);
    	SubMenu sub = menu.addSubMenu(Menu.NONE, MENU_ITEM_CHOOSE_FLOOR, Menu.NONE, "Choose floor");
    	 
    	sub.add(Menu.NONE, MENU_ITEM_BASEMENT, Menu.NONE, "Basement");
    	sub.add(Menu.NONE, MENU_ITEM_1STFLOOR, Menu.NONE, "1. floor");
    	sub.add(Menu.NONE, MENU_ITEM_2NDFLOOR, Menu.NONE, "2. floor");
    	sub.add(Menu.NONE, MENU_ITEM_3RDFLOOR, Menu.NONE, "3. floor");
    	sub.add(Menu.NONE, MENU_ITEM_4THFLOOR, Menu.NONE, "4. floor");
        return true; 
    } 
     
    @Override 
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle item selection 
        switch (item.getItemId()) {
            case MENU_ITEM_BASEMENT:
                setMap(R.drawable.pohja); 
                return true; 
            case MENU_ITEM_1STFLOOR: