Finishing an activity from BroadcastReceiver - Android [duplicate]

。_饼干妹妹 提交于 2019-12-11 06:21:34

问题


Possible Duplicate:
Finishing an Activity from a Broadcast Receiver

Please observe the scenario I have:

Class A extends Activity

Class B extends BroadcastReceiver

How can I finish Activity A from Class B's onReceive method? Any help is much appreciated.


回答1:


The best way to deal with this is to register a broadcast receiver in code inside your activity and listen for that particular broadcast message for which you want to finish your activity.

P.S. Independent Broadcast-Receivers and Services don't have right to manipulate Activities, except for launching Activities as new task.



来源:https://stackoverflow.com/questions/9888013/finishing-an-activity-from-broadcastreceiver-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!