Android 通知-弹出对话框
我正在尝试创建一个对话框,当我的主程序未处于焦点并在后台运行时,该对话框会出现在屏幕中间。该对话框的目的是迫使用户立即采取行动。我已经在使用通知管理器来通知用户,但我仍然想要一个老式的弹出对话框。
谢谢:D
i am trying to create a dialog box to appear in the middle of the screen when my main program is not in focus and running in background. The purpose of the dialog box is to force the user to take an immediate action. I am already using the notification manager to notify the user but i would still like a old school popup dialog box.
Thanks :D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从后台运行的应用程序中弹出对话框被认为是不好的做法,因为它可能会让用户感到困惑,并且可能会惹恼用户,因为你正在扰乱他/她正在执行的当前任务。Android
开发人员建议使用 Android 通知系统来执行此类任务。创建通知的指南位于:http://developer.android.com /guide/topics/ui/notifiers/notifications.html
Popping up a dialog from an application running in the background is thought of as bad practice because it may confuse the user, and may annoy the user because you are disrupting the current task s/he is engaged in.
It is advised by the Android developers to use the Android notification system for tasks like these. A guide to create notifications is here: http://developer.android.com/guide/topics/ui/notifiers/notifications.html
对话框是根据当前活动的意图创建的。由于您的应用程序当时不会成为焦点,因此您无法创建对话框。
Dialogs are created with the Intent of the current activity. Since your app will not be in focus at the time, you cannot create a dialog.