AndroidManifest. xml file (activity-alias)

Source: Internet
Author: User

SYNTAX (SYNTAX ):

<Activity-aliasandroid: enabled = ["true" | "false"]
Android: exported = ["true" | "false"]
Android: icon = "drawable resource"
Android: label = "string resource"
Android: name = "string"
Android: permission = "string"
Android: targetActivity = "string">
...
</Activity-alias>

Included IN (contained in ):

<Application>

Can contain ):

<Intent-filter>

<Meta-data>

DESCRIPTION ):

This element is used to set an alias for the Activity specified by the targetActivity attribute. The target Activity and the alias Activity must be in the same application, and the Activity must be declared before the alias.

The alias is used as an independent entity to represent the target Activity. It can have its own Intent filter settings, rather than its own Intent filter of the target Activity. It can determine which Intent object can activate the target through the alias and the way the system processes the alias. For example, the Intent filter in the alias can specify "android. intent. action. MAIN and android. intent. category. LAUNCHER "flag, so that even if these tags are not specified on the filter of the target Activity, it will be indicated in the app's launch window.

In addition to the targetActivity attribute, <activity-alias> is a subset of <activity> attributes. For attributes in the subset, no value set in the target Activity is transferred to the alias Activity. However, for attributes not in the subset, the value set for the target Activity will also be applied to the alias Activity.

Attribute (ATTRIBUTES)

Android: enabled

This attribute is used to determine whether the system can use this alias to instantiate the target Activity. If this attribute is set to true, it can be instantiated. Otherwise, it cannot be instantiated. The default value is true.

<Application> An element has its own enabled attribute, which is applied to all application components, including the Activity alias. Both the <application> and <activity-alias> attributes must be true, so that the system can instantiate the target Activity through aliases. If one of them is false, the alias will not work.

Android: exported

This attribute is used to set whether other application components can use this alias to start the target Activity. If this attribute is set to true, the target Activity can be started. Otherwise, the target Activity cannot be started. If this parameter is set to false, the target Activity can only be started by application components with the same alias or applications with the same user ID.

Whether the default dependency and alias contain the Intent filter. If no filter exists, this Activity can only call the alias Activity by using the exact alias name, the implicit meaning is that this alias can only be used within the application (because others do not know its name)-So the default value is false. On the other hand, if there is at least one filter, it means that this alias can be used externally-so the default value is true.

Android: icon

When the target Activity is displayed to the user through an alias, this attribute is used to set an icon for the target Activity.

Android: label

When the target Activity is displayed to the user through an alias, this attribute is used to set a readable label for the target Activity.

Android: name

Set a unique name for the alias. This name should be like a fully qualified class name, but it does not need to be like the name of the target Activity. The alias name is arbitrary and does not correspond to an actual class name.

Android: permission

Set the permission name. The client must have this permission to start the target Activity or obtain the target Activity through an alias to do something. If the caller of the startActivity () or startActivityForResult () method is not granted the specified permission, the target Activity will not be activated.

This attribute value replaces any permissions set by the target Activity. If it is not set, the target Activity can be activated by using an alias without permissions.

Android: targetActivity

This attribute is used to set the name of the Activity that can be activated through an alias. This name must match the name attribute of the <activity> element before it.

INTRODUCED version (introduced in ):

This element is introduced in API Level 1.

 


From FireOfStar's column

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.