Share the post "How To Activate Home Button Listener In android.widget.ActionBar"
Actually, there is no need to set a listener for the Home button in android.widget.ActionBar. Simply override the onOptionsItemSelected(MenuItem item) method and you will be good to go.
Check out this short code:
|
1 2 3 4 5 6 7 8 9 |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // home button in action bar clicked default: return super.onOptionsItemSelected(item); } } |