I use ActionBarSherlock (although I don\'t think it matters).
I have a Main activity and an About activity. I want the About activity to show the back-arrow by its l
In your onCreate(Bundle savedInstanceState)
, do
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
Then in your onOptionsItemSelected(MenuItem item)
, do
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// go to previous screen when app icon in action bar is clicked
Intent intent = new Intent(this, PreviousActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
return true;
}
return super.onOptionsItemSelected(item);
}