<action>
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
- ไวยากรณ์:
<action android:name="string" />
- ที่อยู่ใน:
<intent-filter>
- description:
- เพิ่มการดำเนินการลงในตัวกรอง Intent
<intent-filter>
ต้องมีองค์ประกอบ <action>
อย่างน้อย 1 รายการ หากมี
ไม่ใช่องค์ประกอบ <action>
ในตัวกรอง Intent ตัวกรอง
ไม่ยอมรับวัตถุ Intent
ใดๆ
สำหรับรายละเอียดเกี่ยวกับตัวกรอง Intent และบทบาทของการดำเนินการ
ภายในตัวกรอง โปรดดู
ความตั้งใจและ
ตัวกรอง Intent
- ดังนี้
android:name
- ชื่อของการดำเนินการ การดำเนินการมาตรฐานบางอย่างจะกำหนดไว้ในส่วน
Intent
ชั้นเรียนเป็น
ACTION_string
ค่าคงที่ เมื่อต้องการมอบหมายการทำงานอย่างใดอย่างหนึ่งให้กับ
แอตทริบิวต์นี้ แทรก android.intent.action.
ไว้ข้างหน้า
string
ที่ตามหลัง ACTION_
เช่น สำหรับ ACTION_MAIN
ให้ใช้ android.intent.action.MAIN
และสำหรับ ACTION_WEB_SEARCH
ให้ใช้ android.intent.action.WEB_SEARCH
สำหรับการกระทำที่คุณกำหนด คุณควรใช้ชื่อแพ็กเกจของแอปเป็นคำนำหน้าเพื่อ
เพื่อช่วยรับประกันความเป็นเอกลักษณ์ เช่น อาจระบุการดำเนินการ TRANSMOGRIFY
ไว้
ดังนี้
<action android:name="com.example.project.TRANSMOGRIFY" />
- เปิดตัวใน
- API ระดับ 1
- ดูเพิ่มเติม
<intent-filter>
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา 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,["# <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)"]]