帐户首选项 ListPreference 不显示对话框,导致设备崩溃/重启
我正在尝试使用我的自定义帐户存储一些首选项。我已经
android:accountPreferences="@xml/account_preferences"
在authenticator.xml中定义了,res/xml/account_preferences.xml看起来像这样:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="Advanced settings">
<ListPreference
android:title="Marketplace"
android:summary="Select marketplace"
android:key="marketplaceId"
android:defaultValue="715713"
android:entries="@array/marketplaces"
android:entryValues="@array/marketplaceIds"
android:persistent="true"
/>
</PreferenceCategory>
</PreferenceScreen>
两个数组都是在res/values/arrays.xml中的字符串数组元素中定义的。
当我转到“帐户和”时同步并选择一个帐户,我可以在那里看到 Marketplace 字段,但是如果我选择它,我的设备(或模拟器)会冻结并重新启动,并且不会将错误消息写入 LogCat。
我有什么办法可以克服这个问题吗?我需要在首选项文件中指定意图吗?
另外,附带问题,如果我让它工作,我如何以编程方式访问一个特定帐户的首选项?
I'm trying to store a some preferences with my custom accounts. I've defined
android:accountPreferences="@xml/account_preferences"
in my authenticator.xml, and res/xml/account_preferences.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="Advanced settings">
<ListPreference
android:title="Marketplace"
android:summary="Select marketplace"
android:key="marketplaceId"
android:defaultValue="715713"
android:entries="@array/marketplaces"
android:entryValues="@array/marketplaceIds"
android:persistent="true"
/>
</PreferenceCategory>
</PreferenceScreen>
Both arrays are defined in res/values/arrays.xml in string-array elements.
When I go to Accounts & Sync and select an account I can see the Marketplace field there, however if i select it, my device (or emulator) freezes and reboots, with no error message written to LogCat.
Any ideas for how I can get past this? Do I need to specify an intent in the preferences file?
Also, side question, if I get this to work, how do I access the preferences for one particular account programmatically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论