Android应用程序开发:两个图标越来越创建,我只需要一个我只、程序开发、图标、两个

2023-09-05 05:52:09 作者:爱我如何

我写一个Android应用程序,有一个主要活动和一个子活动。当我在我的手机来测试它安装应用程序,我得到两个图标,而不是一个。第一个图标是主要活动,二是为子活动。我不想/需要的子活动的图标。

I am writing an Android App that has one main activity and one subactivity. When I install the app on my phone to test it out, I get two icons instead of one. The first icon is for the main activity and the second is for the subactivity. I don't want/need an icon for the subactivity.

有谁知道如何关闭这个功能在我的应用程序code,所以只安装了主要活动的图标?你可以提供的任何信息,大大AP preciated!

Does anyone know how to turn this off in my app code, so that only the icon for the main activity is installed? Any information you can provide is greatly appreciated!

谢谢, MobiKnow

Thanks, MobiKnow

推荐答案

您的应用程序清单列表下的子活动的意图过滤器相匹配的主发射?

Does your application manifest list an intent filter under your sub-activity that matches the main launcher?

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

请确保您的子活动是没有过滤这些意图。

Make sure that your sub-activity is not filtering for these intents.

编辑:只是要非常清楚,确保上面的行不会在你的子活动列出。这个意图过滤器可以让Android系统知道你打算为它被列为切入点,以您的应用程序。

Just to be very clear, make sure the above lines are not listed under your sub-activity. That intent filter lets the Android system know that you intend for it to be listed as an entry point to your application.