4.3 杂乱无章

  1. Intent存在属性与方法
// 对应的Intent-filter对应的都相同才能启动,听过action和category来筛选对应的intent
intent.setAction();
intent.addCategory();
//通过data和type来筛选对应的intent
intent.setType("abc/xyz");
intent.setData(Uri.parse("lee://www.fkjava.org:8888/test"));
//上面的type和Data会相互覆盖,后面的覆盖前面的。
或者
intent.setDataAndType(Uri.parse("lee://www.fkjava.org:8888/test"),"abc/xyz");`
  1. intent-filter的属性
<intent-filter>
    <action android:name=""/>
    <category android:name=""/>
</intent-filter>
///获取属性的方法
getIntent().getAction();
Set<String> cates = getIntent().getCategories();
<data android:scheme="lee"
        android:host = "www.fkjava.org"
        android:path = "/mypath"/>

3.由Action、Data和属性启动Activity

// 查看固定的网页
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.crazyit.org"))
//编辑固定的联系人
intent.setAction(Intent.ACTION_EDIT);
intent.setData(Uri.parse("content://com.android.contacts/contacts/1"));
//呼叫固定的号码
intent.setAction(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:13800138000"));
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值