Is it possible to show pop up dialog (AlertDialog) in home screen on the android device via services?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
You can not create dialog from service but we have one alternative solution is that You can create
dialog activity
and start that activity from your serviceYou can set Theme of activity as dialog by below way
You could create an
Activity
with theTheme.Dialog
theme. In yourAndroidManifest.xml
file add the theme to the activity, like this:From your service simply start this
Activity
. You will have to start the activity with theIntent.FLAG_ACTIVITY_NEW_TASK
flag. See How to start an Activity from a ServiceDoes anyone needs option, "android:launchMode="singleInstance", when pop activity in the broadcast receiver or Service?? Without this option, my app started automatically and pop MyDialogActivity above it. And then, something happened wrong. (My app has the Main Activity with auto-login function. When the other new Activity started automatically, MyDialogActivity is hided by it.)
So, this is my sample xml code.
I hope someone needs my comments. :)