1).action The general action to be performed, such as ACTION_VIEW, ACTION_EDIT, ACTION_MAIN, 包括Android 系统指定的 和 自定义 [java] intent.setAction("com.baidu.action.TEST"); [html] view plaincopy <action android:name="com.baidu.action.TEST"/> 2).data expressed as a Uri, The data to operate on, such as a person record in the contacts database. 系统自带的Action简单举例 Action Data(Uri) Content ACTION_VIEW content://contacts/people/1 Display information about the person whose identifier is "1". ACTION_VIEW tel:123 Display the phone dialer with the given number filled in. ACTION_DIAL tel:123 Display the phone dialer with the given number filled in. 自定义data匹配 [java] intent.setData(Uri.parse("baidu://www.baidu.com/news")); [html] <!-- android:path 内容字符串需要以 / 开头 --> <data android:scheme="baidu" android:host="www.baidu.com" android:path="/news"/> 3).category Gives additional information about the action to execute. 注意:项目清单的xml文件意图过滤器中必须指定 android.intent.category.DEFAULT类别,Activities will very often need to support the CATEGORY_DEFAULT so that they can be found by Context.startActivity,or Context can't the acitivity component [java] intent.addCategory("com.baidu.category.TEST"); [html] <!-- 必须指定CATEGORY_DEFAULT,只有这样startActivity(intent)才能找到 --> <category android:name="com.baidu.category.TEST" /> <category android:name="android.intent.category.DEFAULT" /> 除了以上主要属性外,下面还有其它属性可以额外增强。 4).type Specifies an explicit type (a MIME type) of the intent data. [java] intent.setType("image/jpeg"); [html] view plaincopy <data android:mimeType="image/*" /> 注意:java文件中data Uri 和 type不能同时使用各自的函数进行设定,因为使用type时会把Uri清除掉,可以使用setDataAndType方法设定 [java] intent.setDataAndType(Uri.parse("baidu://www.baidu.com/news"), "image/jpeg"); [html] <data android:mimeType="image/*" android:scheme="baidu" android:host="www.baidu.com" android:path="/news"/> 两者的使用区别: 显式意图一般在应用的内部使用,因为在应用内部已经知道了组件的名称,直接调用就可以了。 当一个应用要激活另一个应用中的Activity时,只能使用隐式意图,根据Activity配置的意图过滤器建一个意图,让意图中的各项参数的值都跟过滤器匹配,这样就可以激活其他应用中的Activity。所以,隐式意图是在应用与应用之间使用的。