Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Action bar setDisplayHomeAsUpEnabled not working on ICS

Tags:

android

In an activity I have:

ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);

and for that activity in the AndroidManifest

android:parentActivityName=".MainActivity"

and this provides the up button that works correctly on Jelly Bean (4.3), but on ICS (4.0.3) both on a physical device and on the emulator, nothing happens when this button is clicked.

like image 731
L84 Avatar asked Sep 10 '13 10:09

L84


1 Answers

Unfortunately, android:parentActivityName attribute supported only after API level 16 (JellyBean) One alternative is using support-library:v7 combined with NavUtils.

There is a great training material about this topic (include compatibility issue). please check - http://developer.android.com/training/implementing-navigation/ancestral.html

like image 165
Chansuk Avatar answered Nov 15 '22 04:11

Chansuk