Android的广播接收器显示一个对话框? [英] Android Broadcast Receiver showing a dialog?

查看:129
本文介绍了Android的广播接收器显示一个对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,响应警报 - 我真的需要表现出与才去到下一个屏幕一个密码输入错误警报;麻烦的是我似乎并没有能够显示从广播接收器对话框 - ?这样我怎么能显示在收到警报对话框输入密码

I've got an app that responds to an Alert - and I really need to show an alert with a password entry before going on to the next screen; the trouble is I don't seem to be able to show a dialog from a broadcast receiver -- so how can I show a dialog password entry upon receiving an alert?

推荐答案

创建活动,使用 Theme.Dialog ,并调用 startActivity() 来打开它。虽然你不能用一个真正的对话框,您可以创建一个用户界面,看起来像一个对话框

Create an activity, using Theme.Dialog, and call startActivity() to open it. While you cannot use a "real" Dialog, you can create a UI that looks like a Dialog.

记住,弹出基于广播的活动可能会极大地刺激了一些用户,谁可以美联社preciate你的对话框出现在他们的游戏或短信会话或任何中间没有。你不妨实际上考虑提高一个通知,然后显示对话框,当他们打开了通知

Bear in mind that popping up an activity based on a broadcast may greatly irritate some users, who might not appreciate your dialog appearing in the middle of their game or text message conversation or whatever. You may wish to consider actually raising a Notification, then displaying the dialog when they open up that Notification.

这篇关于Android的广播接收器显示一个对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆