Category:

Set Navigation Button on custom toolbar android

To enable back/home button on custom toolbar and add click listener on it use bellow technique. Toolbar toolbarTop = (Toolbar) findViewById(R.id.toolbar_top); setSupportActionBar(toolbarTop); /*getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setIcon(R.drawable.ic_action_home);*/ toolbarTop.setNavigationIcon(getResources().getDrawable(R.drawable.ic_action_home)); toolbarTop.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent homeInt = new Intent(SearchResult.this, Search.class); startActivity(homeInt); finish(); } }); 🙂

Continue Reading
Posted On :