Code example for MenuItem

Methods: getGroupId, getItemId

0
        return true; 
    } 
     
    @Override 
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getGroupId()) {
        case PATCH_GID:
            setPatch(item.getTitle().toString());
            setRange(2,6); 
            return true; 
        case SCALE_GID:
            setScale(item.getTitle().toString().toLowerCase());
            return true; 
        case KEY_GID:
            setKey(item.getItemId());
            return true; 
        default: 
            return super.onOptionsItemSelected(item);
        } 
    } 
    /**