Android的服务和AlertDialog活动 [英] Android Service and AlertDialog Activity

查看:120
本文介绍了Android的服务和AlertDialog活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立它在后台运行,并弹出,即使你是不是在应用程序屏幕目前的警告对话框的服务。我使用的是报警经理。
我的问题是,当我的警告对话框活动弹出 - 它显示了应用程序的活动为背景。换句话说,我不想警告对话框来改变当前的背景,并且用户点击确定后它会回到相同的状态,而不是我的应用程序。
我该怎么做?

I'm trying to build a service which runs in the background and pops up an alert dialog even when you are not in the application screen currently. I'm using an alarm manager. My problem is that when my alert dialog activity pops up - it shows the application activity as background. In other words, I don't want the alert dialog to change the current background and after the user is clicking "OK" it will be back to the same state, and not to my application. How can I do that ?

推荐答案

最简单的方法很可能是让服务弹出一个新的活动。要么你让活动本身看起来像一个对话框,通过在AndroidManifest.xml中添加适当的主题:

The easiest way would probably be to let the service pop up a new activity. Either you make the activity itself look like a dialog by adding the proper theme in the AndroidManifest.xml:

<活动机器人:DialogActivityNAME =机器人:主题=@安卓风格/ Theme.Dialog>

<activity android:name=".DialogActivity" android:theme="@android:style/Theme.Dialog">

或你犯了一个完全透明的活动,显示一个对话框,在启动时。

or you make a completely transparent activity that shows a dialog when it starts.

这篇关于Android的服务和AlertDialog活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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