Friday, 6 January 2017

Display Back Arrow on Toolbar Android








Add this line in onCreate() :-

getSupportActionBar().setDisplayHomeAsUpEnabled(true);


Add this method in your activity class :-

@Override
    public boolean onOptionsItemSelected(MenuItem item) {

        if(item.getItemId() == android.R.id.home){
            finish();
        }

        return super.onOptionsItemSelected(item);

    }


No comments:

Post a Comment