akkk akkk - 1 year ago 161
Android Question

Nothing happens on back button click on Toolbar in Android

When back button is clicked on the Toolbar nothing happens. I dont know whats the problem.

toolbar = (Toolbar) findViewById(R.id.include);
getSupportActionBar().setTitle("Notices For Students");

Answer Source

the back button is nothing more than a menu item so you have to override onOptionsItemSelected

and look for when the button is pressed in there and do something like this

if(menuItem.getItemId() == android.R.id.home){
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download