如何在android中按下结束呼叫时终止任何应用程序?
我正在“TelephonyManager.EXTRA_STATE_OFFHOOK”
上启动一项活动,效果也很好。但在“TelephonyManager.EXTRA_STATE_IDLE”
中我想终止之前打开的活动。我尝试设置全局变量,并且该全局变量与我的活动交互,根据该变量的真实值,我尝试“finish()”
该活动。但当 "TelephonyManager.EXTRA_STATE_IDLE"
完成后,我变得无助。你能帮我一下吗?
由于很多应用程序都使用END CALL
和HOME BUTTON
,我们可以在实际应用程序中逻辑地实现这些吗?
我提到过
1) TelephonyManager.EXTRA_STATE_OFFHOOK
2) TelephonyManager.EXTRA_STATE_IDLE are in MyReceiver class which extends BroadcastReceiver.
I am starting an activity on"TelephonyManager.EXTRA_STATE_OFFHOOK"
and it works well also. but in"TelephonyManager.EXTRA_STATE_IDLE"
i want to terminate that previously opened activity. I tried setting global variable, and that global variable interact my activity, on that variable's true value i tried to "finish()"
that activity. But as "TelephonyManager.EXTRA_STATE_IDLE"
done, i become helpless. Can you please help me out?
As so many application usesEND CALL
and HOME BUTTON
, can we implement these by logically in real application?
I mentioned
1) TelephonyManager.EXTRA_STATE_OFFHOOK
2) TelephonyManager.EXTRA_STATE_IDLE are in MyReceiver class which extends BroadcastReceiver.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在遇到了上述问题这么多麻烦之后,我通过逻辑来解决这个问题!
您只需将此代码添加到您的活动中
After having so much trouble with above question, i come to solve this by logically!!
you just have to add this code into your activity