Can';Android中帐户验证器中设置的t访问首选项

Can';Android中帐户验证器中设置的t访问首选项,android,preferences,account,Android,Preferences,Account,我正在通过帐户验证器在复选框中设置首选项: Intent settingsIntent = new Intent("android.settings.ACCOUNT_SYNC_SETTINGS"); settingsIntent.putExtra("account", mActiveAccount); startActivityForResult(settingsIntent, ACCOUNT_COMPLETE); 使用以下xml格式: <account-authenticator xm

我正在通过帐户验证器在复选框中设置首选项:

Intent settingsIntent = new Intent("android.settings.ACCOUNT_SYNC_SETTINGS");
settingsIntent.putExtra("account", mActiveAccount);
startActivityForResult(settingsIntent, ACCOUNT_COMPLETE);
使用以下xml格式:

<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="com.example.auth"
android:label="@string/auth_label"
android:accountPreferences="@xml/auth_preferences" />

有人知道可以从哪里访问基于帐户验证器的首选项吗?

基于
auth\u preferences.xml
在活动中所做的更改将保存到
com.android.settings\u preferences.xml
,并且不能使用应用程序的
getSharedReferences(文件、上下文)
访问它。我发现的常见解决方案是在帐户首选项中触发一个新的
首选项活动

您将如何做到这一点?如果您无法读取首选项,为什么会有可能创建首选项?这不仅是常见的解决方案,也是它的用途:“preferences属性指向PreferenceScreen xml层次结构,其中包含可调用以管理验证器的PreferenceScreen列表。”
<?xml version="1.0" encoding="UTF-8" ?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/auth_preferences_general_group" />
<PreferenceScreen android:key="account_settings"
    android:title="@string/auth_preferences_general_details_title" 
    android:summary="@string/auth_preferences_general_details_description">
    <intent android:action="com.example.ACCOUNT_SETUP"
        android:targetPackage="com.example.core"
        android:targetClass="com.example.authentication.AuthenticatorAccountOptions" />
</PreferenceScreen>
<PreferenceCategory android:title="@string/auth_preferences_data_sync_group" >
    <CheckBoxPreference
          android:key="checkbox_pref"
          android:title="@string/auth_preferences_data_sync_syncwidget_title" 
          android:summary="@string/auth_preferences_data_sync_syncwidget_description"
          android:defaultValue="true"
          android:persistent="true" />  
</PreferenceCategory>   
SharedPreferences prefs = context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE);
boolean isChecked = prefs.getBoolean("checkbox_pref", true);