Skip to content

Instantly share code, notes, and snippets.

@a7madev
Created October 15, 2014 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a7madev/e841b733cfc69c1836cc to your computer and use it in GitHub Desktop.
Save a7madev/e841b733cfc69c1836cc to your computer and use it in GitHub Desktop.
Android - Back Button in Actionbar
//configure Actionbar
ActionBar actionbar = getActionBar();
actionbar.setDisplayHomeAsUpEnabled(true);
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment