BroadCast receiver dialog issue in Android

China☆狼群 提交于 2019-12-10 10:12:44

问题


I am having the issue regarding popup in broadcast receiver. I have implemented the popup by using activity with theme dialog. But When the app is in background and i received a broadcast. the popup window display above of the my opened activity no stand alone.

How to open the popup window only, not above my background activity.


回答1:


I guess.. in your onReceive method... you can write this

 Intent i = new Intent(context, NightClock.class);
        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(i); 



回答2:


Please check below link may be helpful to you

How can I display a dialog from an Android broadcast receiver?

AlertDialog in BroadcastReceiver



来源:https://stackoverflow.com/questions/6440783/broadcast-receiver-dialog-issue-in-android

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