If the dialog is dismissed,I want to do something for my background.So I want to know if the dialog is dismissed
相关问题
- 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
@Ken Wolf has a great answer to this question.
Just wanted to add that
onDismissListener
was only introduced inAPI 17
. If you are trying to support something lower, you can useonCancelListener
, which is not as good but covers cases like backButton and tapping outside of the AlertDialog.http://developer.android.com/reference/android/content/DialogInterface.OnCancelListener.html#onCancel(android.content.DialogInterface)
I noticed that the
onDismissListener
is called even when you select one of the options in the alert (Yes/No/Neutral button). For meonCancelListener
was the best option since I needed something that tracked an explicit closing of the dialog by clicking outside the alert area.You can use an
onDismissListener
http://developer.android.com/reference/android/content/DialogInterface.OnDismissListener.html
If you are using a
DialogFragment
just overrideonDismiss()
http://developer.android.com/reference/android/app/DialogFragment.html#onDismiss(android.content.DialogInterface)