Home » Android » dialog – Android IllegalArgumentException for dismissDialog

dialog – Android IllegalArgumentException for dismissDialog

Posted by: admin June 15, 2020 Leave a comment

Questions:

I have used following code for download some files from our internet.

The process is running fine. It is reported following crash report:

What is the problem in my code? Is isShowing() check before dismissDialog will solve the prob?

How to&Answers:

Does your progress dialog actually show up?
Instead of dismissing it you could try using removeDialog(PROGRESS_DIALOG); to have it cleaned up.

Answer:

See if this thread helps – AlerDialog is not created – java.lang.IllegalArgumentException: Activity#onCreateDialog did not create a dialog for id X

Answer:

When you do the

during

you already set the ID for the Dialog to some random or null value.
So when you call to dismiss it, the Application thinks you are crazy.