- składnia:
<category android:name="string" />
- zawarte w:
<intent-filter>
- description:
- Dodaje nazwę kategorii do filtra intencji. Zobacz Intencje Filtry intencji zawierające szczegółowe informacje o filtrach intencji i roli kategorii specyfikacji w filtrze.
- atrybuty:
android:name
- Nazwa kategorii. Kategorie standardowe definiuje się w
Intent
zajęcia jakoCATEGORY_name
stałe. Przypisana tutaj nazwa pochodzi z tych stałych przez prefiksandroid.intent.category.
doname
, który pasuje do:CATEGORY_
. Przykład: wartość ciągu znaków dla atrybutuCATEGORY_LAUNCHER
toandroid.intent.category.LAUNCHER
Uwaga: aby otrzymywać intencje pośrednie, musisz podać
CATEGORY_DEFAULT
w filtrze intencji. MetodystartActivity()
istartActivityForResult()
traktuje wszystkie intencje tak, jakby zadeklarowali kategorięCATEGORY_DEFAULT
. Jeśli nie zadeklarujesz tego w filtrze intencji, żadne intencje niejawne nie będą w stanie rozwiązać tego problemu Twojej aktywności.W przypadku kategorii niestandardowych jako prefiksu użyj nazwy pakietu, dlaczego są wyjątkowe.
- wprowadzone w:
- Poziom API 1
- zobacz też:
<action>
<data>
<kategoria>
Treść strony i umieszczone na niej fragmenty kodu podlegają licencjom opisanym w Licencji na treści. Java i OpenJDK są znakami towarowymi lub zastrzeżonymi znakami towarowymi należącymi do firmy Oracle lub jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-27 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-07-27 UTC."],[],[],null,["# <category\u003e\n\nsyntax:\n:\n\n ```xml\n \u003ccategory android:name=\"string\" /\u003e\n ```\n\ncontained in:\n: [\u003cintent-filter\u003e](/guide/topics/manifest/intent-filter-element)\n\ndescription:\n: Adds a category name to an intent filter. See\n [Intents and\n Intent Filters](/guide/components/intents-filters) for details on intent filters and the role of category\n specifications within a filter.\n\nattributes:\n:\n\n `android:name`\n : The name of the category. Standard categories are defined in the\n [Intent](/reference/android/content/Intent) class as `CATEGORY_`*name*\n constants. The name assigned here is derived from those constants\n by prefixing `android.intent.category.` to the\n *name* that follows `CATEGORY_`. For example,\n the string value for `CATEGORY_LAUNCHER` is\n `android.intent.category.LAUNCHER`.\n\n **Note:** To receive implicit intents, you must include the\n [CATEGORY_DEFAULT](/reference/android/content/Intent#CATEGORY_DEFAULT) category in the intent filter. The methods\n [startActivity()](/reference/android/app/Activity#startActivity(android.content.Intent)) and\n [startActivityForResult()](/reference/android/app/Activity#startActivityForResult(android.content.Intent, int)) treat all intents\n as if they declared the [CATEGORY_DEFAULT](/reference/android/content/Intent#CATEGORY_DEFAULT) category.\n If you don't declare it in your intent filter, no implicit intents can resolve\n your activity.\n\n\n For custom categories, use the package name as a prefix so\n that they are unique.\n\nintroduced in:\n: API Level 1\n\nsee also:\n: [\u003caction\u003e](/guide/topics/manifest/action-element)\n\n [\u003cdata\u003e](/guide/topics/manifest/data-element)"]]