- 構文:
<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>
- 上位の要素:
<application>
- 含めることのできる要素:
<intent-filter>
<meta-data>
- 説明:
targetActivity
属性によって指定したアクティビティのエイリアス。ターゲットは、エイリアスと同じアプリ内に存在し、マニフェスト内でエイリアスよりも前に宣言する必要があります。エイリアスは、ターゲット アクティビティを独立したエンティティとして提示し、独自のインテント フィルタ セットを持つことができます。どのインテントがエイリアス経由でターゲットをアクティブにできるのか、そして、どのようにシステムがエイリアスを処理するのかを決定するのは、ターゲット アクティビティのインテント フィルタではなく、エイリアスのインテント フィルタです。
たとえば、エイリアスのインテント フィルタが
"android.intent.action.MAIN"
フラグと"android.intent.category.LAUNCHER"
フラグを指定していた場合、ターゲット アクティビティのフィルタがこのフラグを設定していなくても、アプリ ランチャーで表されます。targetActivity
を除き、<activity-alias>
属性は<activity>
属性のサブセットです。サブセット内に存在している属性の場合、ターゲットに対して設定されている値は、エイリアスには引き継がれません。他方、サブセット内に存在しない属性の場合は、ターゲット アクティビティに対して設定されている値がエイリアスにも適用されます。- 属性:
android:enabled
- システムがこのエイリアス経由でターゲット アクティビティをインスタンス化できるかどうかを指定します。できる場合は
"true"
、できない場合は"false"
です。デフォルト値は"true"
です。<application>
要素には独自のenabled
属性があり、アクティビティ エイリアスを含め、すべてのアプリ コンポーネントに適用されます。そのため、システムがエイリアス経由でターゲット アクティビティをインスタンス化できるようにするには、<application>
属性と<activity-alias>
属性の両方を"true"
にする必要があります。いずれか一方でも"false"
の場合、エイリアスは機能しません。 android:exported
- 他のアプリのコンポーネントがこのエイリアス経由でターゲット アクティビティを起動できるかどうかを指定します。できる場合は
"true"
、できない場合は"false"
です。"false"
にした場合、エイリアス経由でターゲット アクティビティを起動できるのは、エイリアスと同じアプリのコンポーネントか、同じユーザー ID を持つアプリだけです。デフォルト値は、エイリアスにインテント フィルタが含まれているかどうかによって異なります。フィルタが存在しない場合、エイリアス経由でアクティビティを呼び出すには、エイリアスの名前を正確に指定する必要があります。これは、エイリアスがアプリの内部でのみ使用されることを意味します(他では名前がわからないため)。そのため、デフォルト値は
"false"
です。一方、少なくとも 1 つのフィルタが存在している場合、エイリアスは外部から使用できるため、デフォルト値は"true"
です。 android:icon
- ターゲット アクティビティをエイリアス経由でユーザーに提示する際のアイコン。詳細については、
<activity>
要素のicon
属性をご覧ください。 android:label
- エイリアス経由でユーザーに提示する際の、ユーザーが読むことができるエイリアスのラベル。詳細については、
<activity>
要素のlabel
属性をご覧ください。 android:name
- エイリアスの一意の名前。この名前は、完全修飾クラス名と同様です。ただし、ターゲット アクティビティの名前とは異なり、エイリアス名は任意です。実際のクラスを参照するわけではありません。
android:permission
- クライアントがターゲット アクティビティを起動したり、エイリアスを使用してターゲット アクティビティに何かをさせたりする際に必要となる権限の名前。
startActivity()
やstartActivityForResult()
の呼び出し元に指定の権限が付与されていない場合、ターゲット アクティビティはアクティブになりません。この属性は、ターゲット アクティビティ自体に設定されている権限に取って代わります。この属性が設定されていない場合、エイリアス経由でターゲットをアクティブにする際、権限は必要ありません。
権限についての詳細は、アプリ マニフェスト概要の権限のセクションをご覧ください。
android:targetActivity
- エイリアス経由でアクティブにできるアクティビティの名前。この名前は、マニフェスト内でエイリアスよりも前にある
<activity>
要素のname
属性と一致する必要があります。
- 導入時の API レベル:
- API レベル 1
- 関連項目:
<activity>
<activity-alias>
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 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)"]]