2012-10-26

IllegalArgumentException when Dialog dismiss on Android



I got this exception when calling dismissDialog on Android activity.
java.lang.IllegalArgumentException: no dialog with id 0 was ever shown via Activity#showDialog
at android.app.Activity.missingDialog(Activity.java:2663)
at android.app.Activity.dismissDialog(Activity.java:2648)
This is because dialog never been created or not show up yet.
Instead of dismissing, problem is solved if I using:
removeDialog(PROGRESS_DIALOG);  

No comments: