首页 > 编程知识 正文

intent启动组件(请简述以下两个for循环的优缺点)

时间:2023-05-04 04:12:10 阅读:76019 作者:3017

intent-filteractionandroid 3360 name=' com.syy.note.a '/action Android 3360 name=' com.syy.note.b '/categor oid category Android 3360 name=' Android.intent.category.default ' intent-filter action匹配规则:存在,并且必须与filter的action属性匹配

类别匹配规则:

否,如果没有,则与' Android.intent.cate tory.default '匹配。 因此,在设置intent-filter时,category属性必须包含' Android.intent.cate tory.default '

如果有,则必须与过滤器的catetory属性匹配。

data匹配规则:必须具有,并且与过滤器的data属性匹配。 data语法如下:

data Android : scheme=' string ' Android 3360 host=' string ' Android 3360 port=' string ' Android 3360 path=' string ' Anand ' Android 3360 mimeType=' string '/data由mimeType和URI两部分组成,mime type是指image/jpeg、vidio/*等介质类型

方案://host :端口/[路径前缀]使用setDataAndType方法为intent指定数据。

intent.setdataandtype (uri.parse (file ://ABC )、) image/png ); 根据以上内容,可以对开头的Intent-filter赋予与其一致的intent :

intent intent=new intent (com.syy.note.a ); intent.add category (com.syy.category.c ); intent.setdataandtype (uri.parse (file ://ABC )、) text/plain ); 开始活动(intent;

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。