Android: Dismissing a dialog before displaying another
My application displays alert dialogs in some cases. Also, it is possible for a user to launch my application using the VIEW/SEND intent. The scenario I am considering is, the dialog is visible, the user presses 'Home' & selects my application to View/Share a file.
I would want to dismiss the dialog before beginning with the view/share operation. Although I can maintain which dialog is visible and hide it before the operation begins, I was wondering if there is a conventional/reco开发者_StackOverflow中文版mmended way or API, something like activity.dismissAnyVisibleDialog()
that can come in handy.
Thanks a lot,
Akshay
I finally myself maintained which dialog is visible & dismissed it before displaying the next one.
-Akshay
Just close the dialog in the onPause() method (override in your activity). This way it will be dismissed when the activity is no longer visible i.e if you switch to the home screen.
精彩评论