Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Attachment actions
Description
I ran into this problem when using nested PreferenceScreens in xml resource files; I was not able to enable the ActionBar home button in second-level screens. Basically, calling getActionBar() does not return the visible ActionBar of the nested level, but rather the original ActionBar object.
STR:
1. Create and use an xml resource file with nested PreferenceScreens. For example, a simple MyPreferences PreferenceActivity:
## In AndroidManifest.xml
<activity android:name="src.MyPreferences"
android:label="Settings1" />
## preferences.xml loaded by MyPreferences
<PreferenceScreen>
<CheckBoxPreference android:key="pref1"
android:title="pref1title" />
<PreferenceScreen android:title="Settings2">
<CheckBoxPreference android:key="pref2"
android:title="pref2title" />
</PreferenceScreen>
</PreferenceScreen>
2. Launch MyPreferences activity. Action bar title shows "Settings 1". (Calling getActionBar().getTitle() also returns "Settings1".)
3. Click on the nested preference screen, to enter a nested preference screen displaying "Settings2" as the title in the action bar.
4. Call getActionBar().
Expected:
getActionBar() returns the ActionBar object that is currently visible. Calling getActionBar().getTitle() should return "Settings2".
Actual:
getActionBar() returns the first level ActionBar object. Calling getActionBar().getTitle returns "Settings1". There is no way to call methods on the visible action bar (to do things such as enable the home button via setHomeButtonEnabled(), which is false by default in v14+).