I'm using the default menu Navigation Drawer
and have completed the method that already comes in the project to open my activities(Atividades)
. I have already created the classes and I have already called each of them according to the image below, but when I click on a menu item, it does not change the windows.
Andhere'soneofmyclasses:
publicclassSecondActivityextendsAppCompatActivity{privateButtonshare;privateToolbarmToolbar;privateToolbarmToolbarBottom;privateButtonaction_settings;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_second);mToolbarBottom=(Toolbar)findViewById(R.id.inc_tb_bottom);mToolbarBottom.setOnMenuItemClickListener(newToolbar.OnMenuItemClickListener(){@OverridepublicbooleanonMenuItemClick(MenuItemmenuItem){Intentit=null;switch(menuItem.getItemId()){caseR.id.action_facebook:it=newIntent(Intent.ACTION_VIEW);it.setData(Uri.parse("https://www.facebook.com/PrefeituraMunicipalDeJaguaruana"));
break;
case R.id.action_youtube:
it = new Intent(Intent.ACTION_VIEW);
it.setData(Uri.parse("http://www.jaguaruana.ce.gov.br/"));
}
startActivity(it);
return true;
}
});
mToolbarBottom.inflateMenu(R.menu.menu_bottom);
/*mToolbarBottom.findViewById(R.id.iv_settings).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(SecondActivity.this, "Settings pressed", Toast.LENGTH_SHORT).show();
}*/
}
@Override
protected void onResume() {
super.onResume();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
mToolbar.setBackgroundResource(R.drawable.toolbar_rounded_corners);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_second, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if(id == android.R.id.home){
finish();
}
return true;
}