当前位置:首页 > 技术心得 > 正文内容

PhonestateListener如何取消监听

xjtudll9年前 (2017-12-22)技术心得13800

PhonestateListener怎么取消监听?

TelephonyManager tm;
tm.listen(MyPhoneListener myPlistener,PhoneStateListener.LISTEN_CALL_STATE);
class MyPhoneStateListener extends PhoneStateListener{
@override
public void onCallStateChanged(int state,String incomingNumber){
switch(state){
case TekeohonyManager.CALL_STATE_IDLE:
/////
}}
}
这个是注册通话状态监听器的方法,但是我找不到注销监听器的方法,每次在这个程序中有电话来,都会捕获电话状态然后执行代码。

解决办法:

用tm.listen(MyPhoneListener myPlistener,PhoneStateListener.LISTEN_NONE);取消监听即可

参考资料:

http://www.educity.cn/wenda/155711.html

扫描二维码推送至手机访问。

版权声明:本文由鸟的天空发布,如需转载请注明出处。

本文链接:http://www.xjtudll.cn/Exp/484/

标签: Android
分享给朋友:

“PhonestateListener如何取消监听” 的相关文章

安卓弹出Dialog之后,点触摸屏幕任意区域,Dialog消失了的解决方法

参考资料: http://blog.csdn.net/liushuiwen101423/article/details/46412487 http://blog.csdn.net/u012255016/article/details/49888881 http://blog.csdn.net/jds...

BOS单据审核后插件中解锁字段

m_BillInterface.LockCell   Dim dct As KFO.Dictionary     Dim lBillStatusBak As String     lBillStatusBak = m_BillIn...

itunes无法备份ipad,因为未能与ipad开始会话

现象:ipad连接电脑后,提示“itunes无法备份ipad,因为未能与ipad开始会话” 原因:之前备份的时候发现备份进度条长时间未动,以为是死机,所以拔掉了ipad,重新连接后,无法备份。 解决办法: 1、在itunes偏好设置里,删除ipad的旧有备份 2、修复系统权限(不知道这步是不...

Protel99SE交叉线节点处理

Protel99SE交叉线节点处理

在画电路图时,不可避免的会出现十字的交叉线,虽然Protel99SE默认不会在十字交叉处有节点(Junction),但是当你移动原理图的时候,Protel99SE会自动给加上个节点,这点就很不爽了,如图1和图2。    图1 移动前无节点 图2 移动后自动多了节点 但是...

Warning: xx pins must meet Altera requirements for 3.3-, 3.0-, and 2.5-V interfaces. For more information, refer to AN 447: Interfacing Cyclone IV E Devices with 3.3/3.0/2.5-V LVTTL/LVCMOS I/O Systems

Warning: xx pins must meet Altera requirements for 3.3-, 3.0-, and 2.5-V interfaces. For more information, refer to AN 447: Interfacing Cyclone IV E Devices with 3.3/3.0/2.5-V LVTTL/LVCMOS I/O Systems

问题描述: Cyclone IV EP4CE6E22C8N Quartus II编译 每次编译完,都有个warning: Warning: xx pins must meet Altera requirements for 3.3-, 3.0-, and 2.5-V interfaces. For...

OKI单片机——ML610Q4XX 捕获功能

OKI单片机——ML610Q4XX 捕获功能

捕获取得的值是正常的两倍。 配置步骤: 1.通过(P0CON1)设置引脚模式。 2.设置外部引脚中断控制寄存器EXICON1。 3.设置CAPCON寄存器的ECAP1位启动捕获通道1。 /***********************************************/ * @bri...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。