android intent

阅读更多

 

一、显式Intent

1.FirstActivity:

Intent intent = new Intent(FirstActivity.this,SecondActivity.class);

startActivity(intent);

二、隐式Intent

由系统分析Intent,并找出合适的activity去启动

   

   

     

 

 

   

   

   

     

 

 

 

 

 

   

1.action:

intent中的action和过滤规则中任意一个action匹配即可,注意区分大小写

2.category:

对于intent中的category,每一个都必须在过滤规则中定义。

3.data:

要求完全匹配,由mimeType和URI组成:

mimeType指媒体类型,如image/jpeg,audio/mpeg4-generic和video/*等可以表示图片文本视频不同媒体格式。

URI主要指定scheme值,比如http,file,content.其中content,file是默认值。

Intent intent = new Intent("com.ryg.ACTION_START");//action匹配

intent.addCategory("com.ryg.category.c")//category匹配

intent.setDataAndType(Uri.parse("file://abc"),"text/plain");

startActivity(intent)

你可能感兴趣的:(android intent)