如何提示用户一个警告对话框而不是在我的应用程序forground? [英] How to prompt to user an alert dialog but not when my app is forground?

查看:173
本文介绍了如何提示用户一个警告对话框而不是在我的应用程序forground?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向用户显示一个警告对话框中的消息,他可以选择是/否 但我想这样做,即使是自然而然的,主要在我的应用程序不forground,

i want to show the user an alert dialog message, that he can choose yes/no but i want to do that automatical even and mainly when my app is not forground,

像时钟闹钟,可以跳起来屏幕在任何情况下(即使用户在通话)。

like clock alarm, that can jump up to screen in any situation (even if user in call)..

该怎么做? 我成功做到警报..但它想出了只是当我的应用程序forground:/ 使用本指南: http://www.androidhive.info/ 2011/09 /如何对出现警报,对话功能于安卓/

how to do that? i succeed to do alert.. but its came up just when my app is forground :/ using this guide: http://www.androidhive.info/2011/09/how-to-show-alert-dialog-in-android/

请帮我, 感谢的。

推荐答案

您不能,AFAIK,一个对话框需要一个活动。你有可能会满足您的需求的一个选择是创建一个活动对话主题并称之为在接收。所有你需要做的,使它看起来像一个 AlertDialog 是添加

You can't, AFAIK, a Dialog needs an Activity. An option you have that may satisfy your needs is to create an Activity with a Dialog Theme and call this in a Receiver. All you need to do to make it look like an AlertDialog is to add

android:theme="@android:style/Theme.Dialog"

<活性GT; 清单标记。

的BroadcastReceiver

这篇关于如何提示用户一个警告对话框而不是在我的应用程序forground?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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