Detecting Actionbar Home button press event

You can use this method to trigger something when the home or "up/back" button in the actionbar is pressed. For example, save what the user is currently doing or writing. You can listen for the Home button pressed event in the optionsItemsSelected method: @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { doSomething(); return true; } } return super.onOptionsItemSelected(item); } Returning true after executing your method, "consumes" the event, so it does not propagate further.

» Read more