bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.nav_home:
myWeb.loadUrl("https://test.net/");
return true;
case R.id.nav_search:
myWeb.loadUrl("https://test.net/");
return true;
case R.id.nav_profile:
myWeb.loadUrl("https://test.net/");
return true;
default:
return false;
}
}
});
i have webview app..
I am sure that all identifiers (
R.id.nav_home:, R.id.nav_search:R.id.nav_profile:
error: constant expression required
case R.id.nav_home:
^
) are identical to the XML files, but I see this error and the red line below each id.R
Please help me, I am a beginner
Language JAVA
I want to give functionality to the button bar at the bottom of the application interface in the activity file, so that when the user clicks on one of the buttons, he is taken to the desired page.
New contributor
3ARF is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.