Android: Intent matches action, category and data principles, androidintent
1. When you define one or more actions in androidmanifest
When you use an implicit intent for other activities or services, it is required that the action in your implicit intent must match the action defined in XML. You can only match one XML file.
2. When you define one or more category in androidmanifest
Indicates that no category is available in your code, but the "android. intent. category. DEFAULT" clause must be added to the XML file.
If you define one or more category items in the code, you must be the same as that defined in the XML file. For example, if you have defined a category, you must match one in the XML file. If you have defined multiple category
Match All in the XML file one by one!
3. When you define one or more data in androidmanifest
Required that the intent must contain data, and the data can fully match a data in the XML file. note that although no URL is specified in the XML file, the default URL is "file and content"
Therefore, we need to write intent. setDataAndType (Uri. parse ("file: // abc"), "data") in the code ");
Finally, android must be added to both action, category, and data in XML. intent. category. DEFAULT, because when you start the activity, it will add it to you by DEFAULT, but if you do not find it in XML, an error will be reported and the matching fails.
If action, category, and data are set at the same time, they must all be correctly matched.