在 Android SDK 3.0 上找不到 WirelessSettings 活动
我正在将应用程序移植到 SDK 3.0。 我已经修改了设置以使用 PreferenceActivity 中提供的新 Fragment 功能。
我现在遇到的问题是,settings.xml 中的以下配置不再起作用:
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:key="@string/mykey"
android:summary="@string/musummary"
android:title="@string/mytitle" >
<intent
android:action="android.intent.action.MAIN"
android:targetClass="com.android.settings.WirelessSettings"
android:targetPackage="com.android.settings" />
</PreferenceScreen>
com.android.settings.WirelessSettings 未找到。你知道为什么吗?
我的第一个猜测是,现在该活动不再存在,并被一个片段所取代。 问题是我找不到如何调用这个片段。 您知道如何在我的应用程序中嵌入标准 WirelessSettings 片段吗?
谢谢
I'm porting an application to SDK 3.0.
I have already modified the Settings to use the new Fragment feature available in PreferenceActivity.
The problem I have now is that the following configuration I had in the settings.xml does not work any more:
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:key="@string/mykey"
android:summary="@string/musummary"
android:title="@string/mytitle" >
<intent
android:action="android.intent.action.MAIN"
android:targetClass="com.android.settings.WirelessSettings"
android:targetPackage="com.android.settings" />
</PreferenceScreen>
com.android.settings.WirelessSettings is not found. Do you know why?
My first guess is that now that activity does not exist any more and was replaced by a fragment.
The problem is that I can't find how to call this fragment.
Do you know how to embed the standard WirelessSettings Fragment in my application?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,终于我找到了正确的版本。这有效:
OK finally I found the correct version. This works:
他们要么选择重命名该类,要么选择不导出该类。您一开始就不应该使用它——任何对
com.android
的引用都是一个非常糟糕的主意,因为它们不是 Android SDK 的一部分。您不能将其他应用程序的片段嵌入到您自己的应用程序中。
我可以告诉你这在 XOOM 上有效:
你的操作字符串是错误的 - 替换
settings .Settings
仅包含Settings
。尝试一下,看看是否有帮助。如果没有,也许在首选项 XML 中使用
有一些特殊之处——我从未使用过它。无论如何,Settings.ACTION_WIFI_SETTINGS
是引用设置的此特定部分的正确方法。They either elected to rename the class or make it be not exported. You should not have been using this in the first place -- any references to
com.android
are a really bad idea, as they are not part of the Android SDK.You can't embed fragments from other applications in your own application.
I can tell you that this works on a XOOM:
Your action string is wrong -- replace
settings.Settings
with justSettings
. Try that and see if it helps. If not, perhaps there is something peculiar about using<intent>
in preference XML -- I've never used it. Regardless,Settings.ACTION_WIFI_SETTINGS
is the proper way to refer to this particular portion of Settings.