Pop up dialog in Android home screen(在 Android 主屏幕中弹出对话框)
问题描述
是否可以通过服务在安卓设备的主屏幕上显示弹出对话框(AlertDialog)?
Is it possible to show pop up dialog (AlertDialog) in home screen on the android device via services?
推荐答案
您可以使用 Theme.Dialog 主题创建一个 Activity.在您的 AndroidManifest.xml 文件中,将主题添加到活动中,如下所示:
You could create an Activity with the Theme.Dialog theme. In your AndroidManifest.xml file add the theme to the activity, like this:
<activity android:name=".DialogActivity" android:theme="@android:style/Theme.Dialog"></activity>
从您的服务中只需启动这个Activity.您必须使用 Intent.FLAG_ACTIVITY_NEW_TASK 标志开始活动.请参阅如何从服务启动活动
From your service simply start this Activity. You will have to start the activity with the Intent.FLAG_ACTIVITY_NEW_TASK flag. See How to start an Activity from a Service
这篇关于在 Android 主屏幕中弹出对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Android 主屏幕中弹出对话框
基础教程推荐
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
