<アクション>
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
- 構文:
<action android:name="string" />
- 上位の要素:
<intent-filter>
- 説明:
- インテント フィルタにアクションを追加します。
<intent-filter>
要素には、1 つまたは複数の <action>
要素が含まれている必要があります。インテント フィルタ内に <action>
要素が存在しない場合、フィルタは Intent
オブジェクトを受け入れません。
インテント フィルタの詳細やフィルタ内におけるアクション指定の役割については、インテントとインテント フィルタをご覧ください。
- 属性:
android:name
- アクションの名前。一部の標準アクションは、
Intent
クラス内で ACTION_string
定数として定義されています。アクションの 1 つをこの属性に割り当てるには、ACTION_
の後ろにある string
の前に android.intent.action.
を付加します。たとえば、ACTION_MAIN
の場合は android.intent.action.MAIN
、ACTION_WEB_SEARCH
の場合は android.intent.action.WEB_SEARCH
を使用します。
アクションを定義する際は、必ず一意になるように、アプリのパッケージ名をプレフィックスとして使用することをおすすめします。たとえば、TRANSMOGRIFY
アクションの場合は次のように指定します。
<action android:name="com.example.project.TRANSMOGRIFY" />
- 導入時の API レベル:
- API レベル 1
- 関連項目:
<intent-filter>
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[null,null,["最終更新日 2025-07-27 UTC。"],[],[],null,["# <action\u003e\n\nsyntax:\n:\n\n ```xml\n \u003caction android:name=\"string\" /\u003e\n ```\n\ncontained in:\n: [\u003cintent-filter\u003e](/guide/topics/manifest/intent-filter-element)\n\ndescription:\n: Adds an action to an intent filter.\n An [\u003cintent-filter\u003e](/guide/topics/manifest/intent-filter-element)\n element must contain one or more `\u003caction\u003e` elements. If there\n are no `\u003caction\u003e` elements in an intent filter, the filter\n doesn't accept any [Intent](/reference/android/content/Intent) objects.\n For details about intent filters and the role of action\n specifications within a filter, see\n [Intents and\n Intent Filters](/guide/components/intents-filters).\n\nattributes:\n:\n\n `android:name`\n : The name of the action. Some standard actions are defined in the\n [Intent](/reference/android/content/Intent#ACTION_CHOOSER) class as\n `ACTION_`*string* constants. To assign one of these actions to\n this attribute, prepend `android.intent.action.` to the\n *string* that follows `ACTION_`.\n For example, for `ACTION_MAIN`, use `android.intent.action.MAIN`,\n and for `ACTION_WEB_SEARCH`, use `android.intent.action.WEB_SEARCH`.\n\n\n For actions you define, it's best to use your app's package name as a prefix to\n help ensure uniqueness. For example, a `TRANSMOGRIFY` action might be specified\n as follows:\n\n\n ```xml\n \u003caction android:name=\"com.example.project.TRANSMOGRIFY\" /\u003e\n ```\n\nintroduced in:\n: API Level 1\n\nsee also:\n: [\u003cintent-filter\u003e](/guide/topics/manifest/intent-filter-element)"]]