- sintaxis:
<activity-alias android: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>
- se incluye en:
<application>
- puede contener:
<intent-filter>
<meta-data>
- descripción:
- Es un alias para una actividad, nombrado por el atributo
targetActivity
. El objetivo debe estar en la misma aplicación que el alias y debe declararse en el manifiesto antes que el alias.El alias presenta la actividad objetivo como una entidad independiente y puede tener su propio conjunto de filtros de intents. Son estos (en lugar de los filtros de intents de la actividad objetivo) los que determinan qué intents pueden activar el objetivo mediante el alias y cómo el sistema trata el alias.
Por ejemplo, los filtros de intents en el alias podrían especificar las marcas
"android.intent.action.MAIN"
y"android.intent.category.LAUNCHER"
, lo que hace que se represente en el selector de aplicaciones, incluso si ninguno de los filtros de la actividad objetivo configuró estas marcas.A excepción de
targetActivity
, los atributos<activity-alias>
son un subconjunto de atributos<activity>
. En el caso de los atributos del subconjunto, ninguno de los valores establecidos en el objetivo se transmite al alias. Sin embargo, en el caso de los atributos que no forman parte del subconjunto, los valores establecidos para la actividad objetivo también se aplican al alias. - atributos:
android:enabled
- Determina si el sistema puede crear una instancia de la actividad objetivo mediante este alias. Es
"true"
si eso es posible y"false"
si no lo es. El valor predeterminado es"true"
.El elemento
<application>
tiene su propio atributoenabled
que se aplica a todos los componentes de la aplicación, incluidos los alias de la actividad. Los atributos<application>
y<activity-alias>
deben ser"true"
para que el sistema pueda crear instancias de la actividad objetivo por medio del alias. Si alguno es"false"
, el alias no funcionará. android:exported
- Indica si los componentes de otras aplicaciones pueden iniciar la actividad objetivo por medio de este alias. Es
"true"
si eso es posible y"false"
si no lo es. Si es"false"
, solo los componentes de la misma aplicación y los alias o aplicaciones con el mismo ID de usuario pueden iniciar la actividad objetivo mediante el alias.El valor predeterminado depende de si el alias contiene filtros de intents. La ausencia de filtros indica que la actividad solo puede invocarse mediante el alias si se especifica el nombre exacto de este, lo que significa que el alias está destinado únicamente al uso interno de la aplicación, ya que otros no conocen su nombre. Por lo tanto, el valor predeterminado es
"false"
. Por otro lado, la presencia de al menos un filtro significa que el alias está destinado al uso externo; en consecuencia, el valor predeterminado es"true"
. android:icon
- Es un ícono para la actividad objetivo cuando se presenta a los usuarios por medio del alias.
Para obtener más información, consulta el atributo
icon
del elemento<activity>
. android:label
- Es una etiqueta legible por el usuario para el alias cuando se presenta a los usuarios mediante el alias.
Para obtener más información, consulta el atributo
label
del elemento<activity>
. android:name
- Es un nombre único para el alias. El nombre se asemeja a un nombre de clase completamente calificado. Pero, a diferencia del nombre de la actividad objetivo, el nombre del alias es arbitrario. No hace referencia a una clase real.
android:permission
- Es el nombre de un permiso que deben tener los clientes para iniciar la actividad objetivo o que deben obtener para realizar acciones mediante el alias. Si un llamador de
startActivity()
ostartActivityForResult()
no recibe el permiso especificado, la actividad objetivo no se activa.Este atributo reemplaza cualquier conjunto de permisos para la actividad objetivo. Si no está configurado, no se necesita un permiso para activar el objetivo mediante el alias.
Para obtener más información sobre los permisos, consulta la sección Permisos en la descripción general del manifiesto de la app.
android:targetActivity
- Es el nombre de la actividad que puede activarse mediante el alias.
Este nombre debe coincidir con el atributo
name
de un elemento<activity>
que antecede al alias en el manifiesto.
- primera inclusión:
- Nivel de API 1
- consulta también:
<activity>
<alias-de-actividad>
El contenido y las muestras de código que aparecen en esta página están sujetas a las licencias que se describen en la Licencia de Contenido. Java y OpenJDK son marcas registradas de Oracle o sus afiliados.
Última actualización: 2025-07-27 (UTC)
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-07-27 (UTC)"],[],[],null,["# <activity-alias\u003e\n\nsyntax:\n:\n\n ```xml\n \u003cactivity-alias android:enabled=[\"true\" | \"false\"]\n android:exported=[\"true\" | \"false\"]\n android:icon=\"drawable resource\"\n android:label=\"string resource\"\n android:name=\"string\"\n android:permission=\"string\"\n android:targetActivity=\"string\" \u003e\n ...\n \u003c/activity-alias\u003e\n ```\n\ncontained in:\n: [\u003capplication\u003e](/guide/topics/manifest/application-element)\n\ncan contain:\n: [\u003cintent-filter\u003e](/guide/topics/manifest/intent-filter-element)\n\n [\u003cmeta-data\u003e](/guide/topics/manifest/meta-data-element)\n\ndescription:\n: An alias for an activity, named by the `targetActivity`\n attribute. The target must be in the same application as the\n alias and declared before the alias in the manifest.\n\n\n The alias presents the target activity as an independent entity, and can have its own set of intent\n filters. They, rather than the\n intent filters on the target activity itself, determine which intents\n can activate the target through the alias and how the system\n treats the alias.\n\n For example, the intent filters on the alias might\n specify the [\"android.intent.action.MAIN\"](/reference/android/content/Intent#ACTION_MAIN)\n and [\"android.intent.category.LAUNCHER\"](/reference/android/content/Intent#CATEGORY_LAUNCHER)\" flags, causing it to\n be represented in the application launcher, even though none of the\n filters on the target activity itself set these flags.\n\n\n With the exception of `targetActivity`, `\u003cactivity-alias\u003e`\n attributes are a subset of [\u003cactivity\u003e](/guide/topics/manifest/activity-element) attributes.\n For attributes in the subset, none of the values set for the target carry over\n to the alias. However, for attributes not in the subset, the values set for\n the target activity also apply to the alias.\n\nattributes:\n:\n\n `android:enabled`\n : Whether the target activity can be instantiated by the system through\n this alias. `\"true\"` if it can be, and `\"false\"` if not.\n The default value is `\"true\"`.\n\n\n The [\u003capplication\u003e](/guide/topics/manifest/application-element) element has its own\n [enabled](/guide/topics/manifest/application-element#enabled) attribute that applies to all\n application components, including activity aliases. The\n `\u003capplication\u003e` and `\u003cactivity-alias\u003e`\n attributes must both be `\"true\"` for the system to be able to instantiate\n the target activity through the alias. If either is `\"false\"`, the alias\n doesn't work.\n\n `android:exported`\n : Whether the components of other applications can launch the target activity\n through this alias. `\"true\"` if they can, and `\"false\"` if not.\n If `\"false\"`, the target activity can be launched through the alias only by\n components of the same application as the alias or applications with the same user ID.\n\n\n The default value depends on whether the alias contains intent filters. The\n absence of any filters means that the activity can be invoked through the alias\n only by specifying the exact name of the alias. This implies that the alias\n is intended only for application-internal use, since others don't know its name.\n So, the default value is `\"false\"`.\n On the other hand, the presence of at least one filter implies that the alias\n is intended for external use, so the default value is `\"true\"`.\n\n `android:icon`\n : An icon for the target activity when presented to users through the alias.\n For more information, see the [\u003cactivity\u003e](/guide/topics/manifest/activity-element) element's\n [icon](/guide/topics/manifest/activity-element#icon) attribute.\n\n `android:label`\n : A user-readable label for the alias when presented to users through the alias.\n For more information, see the [\u003cactivity\u003e](/guide/topics/manifest/activity-element) element's\n [label](/guide/topics/manifest/activity-element#label) attribute.\n\n \u003cbr /\u003e\n\n `android:name`\n\n : A unique name for the alias. The name resembles a fully qualified class name. But, unlike the name of the target activity, the alias name is arbitrary. It doesn't refer to an actual class. \u003cbr /\u003e\n\n `android:permission`\n : The name of a permission that clients must have to launch the target activity\n or get it to do something using the alias. If a caller of\n [startActivity()](/reference/android/content/Context#startActivity(android.content.Intent)) or\n [startActivityForResult()](/reference/android/app/Activity#startActivityForResult(android.content.Intent, int))\n isn't granted the specified permission, the target activity isn't activated.\n\n This attribute supplants any permission set for the target activity itself. If\n it isn't set, a permission isn't needed to activate the target through the alias.\n\n\n For more information about permissions, see the\n [Permissions](/guide/topics/manifest/manifest-intro#perms)\n section in the app manifest overview.\n\n `android:targetActivity`\n : The name of the activity that can be activated through the alias.\n This name must match the `name` attribute of an\n [\u003cactivity\u003e](/guide/topics/manifest/activity-element) element that precedes\n the alias in the manifest.\n\n \u003cbr /\u003e\n\nintroduced in:\n: API level 1\n\nsee also:\n: [\u003cactivity\u003e](/guide/topics/manifest/activity-element)"]]