Android广播接收器显示一个对话框?

Android Broadcast Receiver showing a dialog?(Android广播接收器显示一个对话框?)
本文介绍了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?

推荐答案

创建一个activity,使用Theme.Dialog,调用startActivity()打开它.虽然您不能使用真正的"Dialog,但您可以创建一个看起来像 Dialog 的 UI.

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.

请记住,根据广播弹出活动可能会极大地激怒某些用户,他们可能不喜欢您的对话出现在他们的游戏或短信对话或其他任何事情的中间.您可能希望考虑实际提出一个 Notification,然后在他们打开该 Notification 时显示对话框.

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广播接收器显示一个对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

How To Create a Rotating Wheel Control?(如何创建转轮控件?)
How to avoid restarting activity when orientation changes on Android(如何在 Android 上的方向更改时避免重新启动活动)
Screen orientation lock(屏幕方向锁定)
Strange behavior with android orientation sensor(android方向传感器的奇怪行为)
Android: Rotate image in imageview by an angle(Android:将imageview中的图像旋转一个角度)
Activity restart on rotation Android(旋转Android上的活动重启)