由于nv =(NavigationView)findViewById(R.id.nav)上的switch语句而导致无法到达的语句
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;
它说这部分代码无法访问
case R.id.menu_don:
Intent imMenuDon = new Intent(getApplicationContext(), DonActivity.class);
startActivity(imMenuDon);
}
return true;
}
});
}
}