开发者

Android: Dismissing a dialog before displaying another

开发者 https://www.devze.com 2023-03-01 02:14 出处:网络
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 u

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消