I'm trying to display a Back button
on the Action bar
to move previous page/activity or to the main page (first opening).
And I can not do it.
my code.
ActionBar actionBar = getActionBar();
actionBar.setHomeButtonEnabled(true);
the code is in onCreate
.
well this is simple one to show back button
actionBar.setDisplayHomeAsUpEnabled(true);
and then you can custom the back event at onOptionsItemSelected
case android.R.id.home:
this.finish();
return true;