Let's say I have a PreferenceActivity (which I cannot convert to use Fragments for compatibility reasons). One setting within that PreferenceActivity is for the current application theme, which I would like to apply instantly when changing the preference by calling PreferenceActivity#recreate() to force recreating the activity (using the new theme).
Unfortunately, the activity contains so many settings that scrolling may be required. Upon recreating the activity, I would like to restore the previous scroll position to allow for a seamless transition from one theme to another.
Attemting to preserve the embedded ListView's scroll position using getListView().getScrollY() in onSaveInstanceState, however, always returns zero.
Is there any way to get hold of the PreferenceActivity's list scroll position and to restore it later on?