Hi all! Does anyone know how to properly use the PreferenceActivity.addPreferencesFromIntent(Intent) method?!
Android reference (http://developer.android.com/reference/android/ preference/PreferenceActivity.html) says: "To specify an Intent to query Activities that each have preferences, use addPreferencesFromIntent(Intent). Each Activity can specify meta-data in the manifest (via the key METADATA_KEY_PREFERENCES) that points to an XML resource. These XML resources will be inflated into a single preference hierarchy and shown by this activity" So I created a PreferenceActivity overriding onCreate() as follow: protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); addPreferencesFromIntent(new Intent("mypackage.MYKEY")); } Then, I added the following lines into the AndroidManifest file: <activity android:name=".AnotherActivity"> ... <intent-filter> <action android:name="mypackage.MYKEY" /> </intent-filter> <meta-data android:name="android.preference" android:resource="@xml/ settings" /> </activity> and xml/settings.xml contains <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/ android" android:key="settings"> <CheckBoxPreference android:key="1-check-box" android:title="1. Check Box" /> <EditTextPreference android:key="2-edit-text" android:title="2. Edit Text" /> </PreferenceScreen> Now, all is showed and the CheckBoxPreference works fine but when I click to the EditTextPrefence the following exception occurs: "android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application" ... It seems to be related to the dialog that should appear but that is never shown. Any ideas?! Thanks in advance, Francesco --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---