andreluizreis
6/1/2017 - 12:05 AM

Select Menu Item from Navigation Drawer

Select Menu Item from Navigation Drawer

protected void setCurrentItemId(int currentItemId) {
        mCurrentItemId = currentItemId;
        int menuIndex;
        
        switch (currentItemId) {
            case R.id.nav_inbox:
                menuIndex = 0;
                break;
            case R.id.nav_bids:
                menuIndex = 1;
                break;
            case R.id.nav_hires:
                menuIndex = 2;
                break;
            case R.id.nav_calendar:
                menuIndex = 3;
                break;
            case R.id.nav_profile:
                menuIndex = 4;
                break;
            case R.id.nav_settings:
                menuIndex = 6;
                break;
            default:
                menuIndex = 0;
        }

        mNavigationView.getMenu().getItem(menuIndex).setChecked(true);
    }
protected void setCurrentItemId(int currentItemId) {
    mCurrentItemId = currentItemId;
    mNavigationView.setCheckedItem(mCurrentItemId);
}