Sunil Kumar Sahoo
Sunil Kumar Sahoo

Reputation: 53647

How to dismiss a particular dialog using its id

I found removeDialog(id) and dismissDialog(id) is deprecated. How to dismiss a dialog using its id. Different type of dialogs are associated with different id in my application. in some case i have to show progressdialog, and in some other case alert dialog also i am showing different messages. thats why I am passing id to showDialog(id) method to show dialog. Now I want to dismiss a particular dialog. I have the id of the dialog. How to dismiss the dialog.

Thaanks Sunil

Upvotes: 0

Views: 2173

Answers (4)

Jack Gao
Jack Gao

Reputation: 886

Since showDialog() and dismissDialog() is deprecated in SDK API level 11, you could use support package to use DialogFragment to have backward compatibility.

Support Package Link

Upvotes: 0

Vladimir
Vladimir

Reputation: 9743

You've probably read it at javadoc for Activity. You may also notice that showDialog() is deprecated as well. It is suggested to use DialogFragment instead, but since it was only introduced in API 11, and if your app is targeted for lower APIs, I believe its totally okay to continue using showDialog() and removeDialog().

Upvotes: 2

skynet
skynet

Reputation: 9908

Look at the javadoc on the developer site for dismissDialog. It says

This method is deprecated.

Use the new DialogFragment class with FragmentManager instead; this is also available on older platforms through the Android compatibility package.

so you could look into using DialogFragment and FragmentManager, as they are the suggested replacement.

Upvotes: 0

manf
manf

Reputation: 55

dismissDialog(id)

You should have a look here:

http://developer.android.com/guide/topics/ui/dialogs.html#DismissingADialog

Upvotes: 0

Related Questions