什么是主要的,违约和发射器在Android清单文件中的应用发射器、清单、文件、Android

2023-09-12 04:36:59 作者:浮生寄旧梦

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

- 可以任何一个解释这主要,默认和发射器有什么用清单中的这些属性的活动,如果在我的项目中使用超过1活动?

-Can any one explain about main, default and launcher what are the use of those properties in manifest for activity if used more than 1 activity in my project?

推荐答案

android.intent.action.MAIN 匹配所有可以用来作为顶级入口点到应用程序的活动。

android.intent.action.MAIN matches all of the activities that can be used as top-level entry points into an application.

的LAUNCHER 分类说,该入口点应该列在应用程序启动。

The LAUNCHER category says that this entry point should be listed in the application launcher.

默认类是必需的 Context.startActivity()的方法来解决你的活动时,它的组件名称没有明确指定。

The default category is required for the Context.startActivity() method to resolve your activity when its component name is not explicitly specified.

因此​​类 LAUNCHER +行动MAIN 让这个活动的图标显示在提供应用程序的发射器列表。

So category LAUNCHER + action MAIN let the icon for this Activity show up in the launchers list of available "applications".

您可以有这样的意图过滤器在多个活动在的Andr​​oidManifest.xml 键,所有的人将在列表中显示出来客应用程序。

You can have this intent-filter on more than one Activity in your AndroidManifest.xml and all of them will show up in the list off "applications".

意图都记录这里和IntentFilters的这里

Intents are documented here and IntentFilters here.