Finally, I was able to successfully launch my user setup. The downfall of the pit was that you need to save the following XML format (e.g. above):
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceCategory android:title="Account settings" /> <PreferenceScreen android:key="key" android:title="General settings" android:summary="Some summary"> <intent android:action="my.account.preference.MAIN" android:targetClass="prefs.AccountPreferencesActivity.class"> </intent> </PreferenceScreen> </PreferenceScreen>
And the corresponding AndroidManifest.xml entry:
<activity android:label="Account preferences" android:name=".prefs.AccountPreferencesActivity"> <intent-filter> <action android:name="my.account.preference.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>
If you look into the Android code , you can find the following lines of code:
private void updatePreferenceIntents(PreferenceScreen prefs) { for (int i = 0; i < prefs.getPreferenceCount(); i++) { Intent intent = prefs.getPreference(i).getIntent(); if (intent != null) { intent.putExtra(ACCOUNT_KEY, mAccount);
and they add the flag to the intent specified in the XML. But this only works for all 1st grade children PreferenceScreen. My mistake was that I encapsulated my intent in the PreferenceCategory, and so the flag was never OR-ed.
Hope I can help.
source share