Trying to open new activities from NavigationDrawer, but it says unreachable statement

71 views Asked by At

unreachable statement because of the switch statement on nv = (NavigationView) findViewById(R.id.nav)

     nv = (NavigationView) findViewById(R.id.nav);

    nv.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            switch (item.getItemId()) {
                case R.id.menu_posts:
                    Intent iMenuPosts = new Intent(getApplicationContext(), PostsActivity.class);
                    startActivity(iMenuPosts);
                    break;

it says that this part of the code is unreachable

case R.id.menu_don:
                    Intent imMenuDon = new Intent(getApplicationContext(), DonActivity.class);
                    startActivity(imMenuDon);
            }
            return true;
        }
    });
}

}
0

There are 0 answers