点击拨号键,可选择自己的程序

一般点击拨号键 会跳出你手机中所安装的有关联系人程序,比如:系统自带的、火星通讯录、QQ通讯录等等。

我没自己需要添加进去 怎么办呢?

只要在程序的manifest文件要加上

<activity android:name="xxx" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CALL_BUTTON"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>


这里会有一个问题,就是我没点击拨号键肯定是希望跳转到拨号盘界面去的,但是你会发现
老是跳转之前退出页面时的界面

这里MAIN-activty中需要使用重写

@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if(intent.getAction().equals(Intent.ACTION_CALL_BUTTON))
{
//.
//这里是在MAIN-Activty中的逻辑代码
//.
}
}


[color=red][b]不过这个CALL_BUTTON之前只是在模拟器上测试 然后一直按的是右边的绿色的拨号键,都是有用的,然后到真机上测试 记过没有真正的拨号键了 只有系统中的拨号键 才发现 原来这两者是不一样的 我晕了 我不知道 咋办了[/b][/color]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值