简体   繁体   English

为什么必须在清单文件中注册活动

[英]why acitivies have to be registered in manifest file

we worked for exam with our friends. 我们和朋友一起参加考试。 I tried to explain manifest file, talking about how to do things. 我试图解释清单文件,谈论如何做。 But I see that I did know why to register activities to androidManifest.xml. 但是我看到我确实知道为什么要向androidManifest.xml注册活动。 Still do not know :). 仍不知道 :)。 Does anyone have an idea? 有人有主意吗?

The manifest file is used by the system to know what kind of components do the application have. 清单文件由系统用来了解应用程序具有哪些组件。 Without registering your Activities / Services / Receivers / Content Providers the system would have to scan and parse the whole apk every time someone wants to use a specific component to find it. 如果不注册您的Activities / Services / Receivers / Content Providers则每次有人要使用特定组件来查找它时,系统都必须扫描并解析整个apk。 This would be really slow, that's why there is the AndroidManifest.xml , which is a small file, and it can be parsed fast to find the required component. 这真的很慢,这就是为什么有AndroidManifest.xml的原因,它是一个小文件,可以对其进行快速解析以找到所需的组件。

Manifest file describes the following features... 清单文件描述了以下功能...

  1. Version Number and Version Code: This is useful, when you are uploading the application in Google play or go for upgrade the existing published apk. 版本号和版本代码:当您在Google Play中上传应用程序或升级现有已发布的APK时,此功能很有用。

2.minSdk and targetSdk: mentioned your min and max version number your application supports. 2.minSdk和targetSdk:提到了您的应用程序支持的最小和最大版本号。

3.application tag: used to set the first activity or home activity when you launch an application from laucher. 3.application标签:用于设置从laucher启动应用程序时的第一个活动或家庭活动。

4.activity tag: the list of all activities in the application declared as child tag in application tag for the easier navigation to activity manager. 4.activity标签:在应用程序标签中声明为子标签的应用程序中所有活动的列表,以便更轻松地导航到活动管理器。

When we switch one activity to another activity, the activity manager checks whether this activity is declared in manifest file or not. 当我们将一个活动切换到另一个活动时,活动管理器会检查此活动是否在清单文件中声明。 If not found throws exception. 如果找不到,则抛出异常。

Uses: Developer can have look at all the activities at a glance (By Manifest file) 用途:开发人员可以一目了然地查看所有活动(通过清单文件)

5.Filter tags: By intent filters in activity tag, User can open any kind of application activity. 5.Filter标签:通过活动标签中的意图过滤器,用户可以打开任何类型的应用程序活动。

  1. Uses permission and Uses features: All application resources are declared here. 使用权限和使用功能:在此声明所有应用程序资源。 example: Internet connectivity is needed for your application, Uses WIFI in your application. 例如:您的应用程序需要Internet连接,您的应用程序中使用WIFI。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM