kanytu / android-material-drawer-template

An Android template with navigation drawer for material design
Apache License 2.0
674 stars 217 forks source link

setHomeButtonEnabled dosn't work #28

Closed bakbuz closed 9 years ago

bakbuz commented 9 years ago

How can I run?

code: getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);

kanytu commented 9 years ago

When are you calling such methods? And what you're trying to do with them?

bakbuz commented 9 years ago

Select one of the items listed to open and display the details so that I want to active the back button on the screen

kanytu commented 9 years ago

Then getSupportActionBar().setDisplayHomeAsUpEnabled(true); will work:

@Override
public void onNavigationDrawerItemSelected(int position) {
    Toast.makeText(this, "Menu item selected -> " + position, Toast.LENGTH_SHORT).show();
    if( getSupportActionBar()!=null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
}

image