From the documentation for AbstractAccountAuthenticator :
The preference attribute points to the xml hierarchy of the PreferenceScreen, which contains a list of PreferenceScreens that can be called to manage the authenticator. Example:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceCategory android:title="@string/title_fmt"/> <PreferenceScreen android:key="key1" android:title="@string/key1_action" android:summary="@string/key1_summary"> <intent android:action="key1.ACTION" android:targetPackage="key1.package" android:targetClass="key1.class"/> </PreferenceScreen> </PreferenceScreen>
Thus, it seems that even if you can set individual preferences in account_preferences.xml , it is not assumed that the values ββare not available.
See this question and answer for how to set up and process a PreferenceScreen intent.
EDIT
For a very simple working example, you can download the sample application from the "Sync Adapter Training Documents" and modify it as follows.
Create res/xml/account_preferences.xml that looks like
<?xml version="1.0" encoding="UTF-8" ?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceCategory android:title="Category"/> <PreferenceScreen android:key="key1" android:title="@string/app_name" android:summary="@string/account_name"> <intent android:targetPackage="com.example.android.network.sync.basicsyncadapter" android:targetClass="com.example.android.network.sync.basicsyncadapter.EntryListActivity"/> </PreferenceScreen> </PreferenceScreen>
Add android:accountPreferences="@xml/account_preferences" to the account-authenticator tag in authenticator.xml .
This example starts the action in this example, but you can easily launch the PreferenceActivity (or any other action you want). For more information on setting PreferenceActivity, see Settings .
For a real world example from the main Android application, see the implementation of the email application here .
mpkuth
source share