I have had this problem recently, and that is how I solved it. First, to access the PreferenceScreen, I use the same method that you mentioned above.
@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { super.onPreferenceTreeClick(preferenceScreen, preference);
From here I looked at what PreferenceScreen is , and I was saddened to learn that this was just a shell of dialogue. Moving forward, I then set the display options for the action bar and try to find the home button. Unfortunately, this was not so simple, but by viewing the hierarchy, I was able to access by finding the house icon and then its parent views. When we have access to the containing LinearLayout, we can attach the onClickListener, where we cancel the PreferenceScreen dialog, which calls the PreferenceScreen onDismissListener and returns us to the previous screen.
public static void initializeActionBar(PreferenceScreen preferenceScreen) { final Dialog dialog = preferenceScreen.getDialog(); if (dialog != null) {
jimmithy May 28 '13 at 20:05 2013-05-28 20:05
source share