在 Android SDK 3.0 上找不到 WirelessSettings 活动

发布于 2024-12-13 23:12:51 字数 771 浏览 5 评论 0原文

我正在将应用程序移植到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

極樂鬼 2024-12-20 23:12:51

好吧,终于我找到了正确的版本。这有效:

        <intent 
            android:action="android.settings.WIRELESS_SETTINGS"/>

OK finally I found the correct version. This works:

        <intent 
            android:action="android.settings.WIRELESS_SETTINGS"/>
浅浅 2024-12-20 23:12:51

com.android.settings.WirelessSettings 未找到。你知道为什么吗?

他们要么选择重命名该类,要么选择不导出该类。您一开始就不应该使用它——任何对 com.android 的引用都是一个非常糟糕的主意,因为它们不是 Android SDK 的一部分。

您知道如何在我的应用程序中嵌入标准 WirelessSettings 片段吗?

您不能将其他应用程序的片段嵌入到您自己的应用程序中。

我也尝试过:带着这个意图,我得到: android.content.ActivityNotFoundException: No Activity found to handle Intent {...

我可以告诉你这在 XOOM 上有效:

startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));

你的操作字符串是错误的 - 替换 settings .Settings 仅包含Settings。尝试一下,看看是否有帮助。如果没有,也许在首选项 XML 中使用 有一些特殊之处——我从未使用过它。无论如何,Settings.ACTION_WIFI_SETTINGS 是引用设置的此特定部分的正确方法。

com.android.settings.WirelessSettings is not found. Do you know why?

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.

Do you know how to embed the standard WirelessSettings Fragment in my application?

You can't embed fragments from other applications in your own application.

I have also tried: with that intent I get: android.content.ActivityNotFoundException: No Activity found to handle Intent {...

I can tell you that this works on a XOOM:

startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));

Your action string is wrong -- replace settings.Settings with just Settings. 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文