二:方法说明
Intent i = new Intent(Intent.ACTION_VIEW,uri);手机的Intent分发过程中,会根据http://www.google.com 的scheme判断出数据类型type 。手机的Brower则能匹配它,在Brower的Manifest.xml中的IntenFilter中 首先有ACTION_VIEW Action,也能处理http:的type,
附:有关各个Action等的意义可以参考:玩转Android---组件篇---Intent(意图)
一些使用案例,action可以用来发送短信打电话等等:android intent和intent action大全
三:传递数据
关于Bundle的用法参考:Android Bundle类 bundle可以传递很多类型的数据。具体参考Bundle类。
Intent可以传递不同类型的数据,在Intent的方法中可以找到,例如CharSequence类型等等。
四、一些Summary的使用
关于FLAG_ACTIVITY_CLEAR_TOP和FLAG_ACTIVITY_REORDER_TO_FRONT
android之Itent.ACTION_PICK Intent.ACTION_GET_CONTENT妙用
五:注意事项
1.组件的名字通过setComponent(),setClass()或setClassName()设置,通过getComponent()读取
2.我们还可以定义自己的动作字符串以在我们的应用程序中激活组件。一个intent对象的动作通过setAction()方法设置,通过getAction()方法读取。
3.setData()方法指定数据的URI,setType()指定MIME类型,setDataAndType()指定数据的URI和MIME类型。通过getData()读取URI,getType()读取类型。
4.理论上来说,如果intent不指定category,那么无论intent filter的内容是什么都应该是匹配的。但是,如果是implicit intent,Android默认给加上一个CATEGORY_DEFAULT,这样的话如果intent filter中没有android.intent.category.DEFAULT这个category的话,匹配测试就会失败。所以,如果你的 activity支持接收implicit intent的话就一定要在intent filter中加入android.intent.category.DEFAULT。
六:Intent Action 实例大全