启动从服务对话框 [英] Launching Dialog from Service

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

问题描述

我想从悬停在无论用户正在寻找一个服务启动的对话框。该对话框被推出这样的:服务获取触发打开对话框>启动透明的活动>透明的活动显示对话框。

I want to launch a dialog from a service that hovers over whatever the user is currently looking at. The dialog gets launched like this: service gets trigger to open dialog > start transparent activity > transparent activity shows dialog.

我的问题是,当用户打开应用程序,启动进入主菜单,然后presses HOME离开。通过pressing HOME,它的叶子上暂停在主菜单的活动,不被破坏,而当服务启动的对话框中,主菜单被显示在透明的活动之下;将鼠标悬停无论用户在看的引起对话框松动的影响。

My problem is when the user opens the app, launches into the main menu, and then presses HOME to leave. By pressing HOME, it leaves the main menu activity on pause, not destroyed, and when the service starts the dialog, the main menu gets shown underneath the transparent activity; causing the dialog to loose the affect of hovering over whatever the user is looking at.

如何才能让这个在应用程序的任何其他活动的透明活动被独立开的呢?以prevent的唯一方法目前这是完成所有的活动在暂停后;但这是不切实际的。

How can make it so that the transparent activity gets opened independently of any other activities in the app? The only way to prevent this currently is to finish all the activities when they are paused; but this is impractical.

推荐答案

发现了这一点我自己,只是 Intent.FLAG_ACTIVITY_MULTIPLE_TASK 标志添加到启动意图;当然与 Intent.FLAG_ACTIVITY_NEW_TASK 标志一起。

Found this out myself, just add the Intent.FLAG_ACTIVITY_MULTIPLE_TASK flag to the launch Intent; of course in conjunction with the Intent.FLAG_ACTIVITY_NEW_TASK flag.

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

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