Created
June 23, 2016 04:45
-
-
Save shihabmi7/aeed64d9c1405f99985e93ad65280f91 to your computer and use it in GitHub Desktop.
Action Bar Heads Up Display: Check Home Page & Set Back Button
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionBar mActionBar = getSupportActionBar(); | |
// checking either this is home actiivty or not for | |
// ActionBar.DISPLAY_HOME_AS_UP | |
if (this.getClass().getSimpleName() | |
.equalsIgnoreCase(RestaurentListActivity.class.getSimpleName())) { | |
mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | |
| ActionBar.DISPLAY_SHOW_CUSTOM | |
| ActionBar.DISPLAY_SHOW_HOME); | |
} else { | |
mActionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP | |
| ActionBar.DISPLAY_SHOW_TITLE | |
| ActionBar.DISPLAY_SHOW_CUSTOM | |
| ActionBar.DISPLAY_SHOW_HOME); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar mActionBar = getSupportActionBar();
mActionBar.setDisplayHomeAsUpEnabled(true);
*
*