redth-org / AndHUD

Android Progress HUD and Dialog helpers for Xamarin.Android apps!
Apache License 2.0
180 stars 69 forks source link

Modified DismissCurrent( ) so that CurrentDialogs which are no longer… #26

Closed ScottSuppan closed 5 years ago

ScottSuppan commented 7 years ago

Our company is receiving the Java.Lang.IllegalArgumentException as well but we believe it is due to some background processes which may/may not show an error dialog prior to navigating to a new activity. While this doesn't happen often, it can and does happen. As a result, attempting to show another dialog results in the view not being attached to a window via the Java.Lang.IllegalArgumentException. We need the software to tidy up the dialog and continue operating under a new "context".

The changes I introduced are really small. However, editor settings made them look big. Basically, I added an int member var to hold the hash key of a context. This last hash key is always checked against the most current context's hash key to see if the activity is the same. Only then will CurrentDialog.Dismiss( ) not generate the Java.Lang.IllegalArgumentException. If they are different, I simply let the code null out the CurrentDialog and force the GC to collect the data for good measure.

Redth commented 7 years ago

Sorry for the delayed response, but please fix the diff to only include your actual changes (not whitespace changes) and I'll have a look at merging.

Thanks

Cheesebaron commented 5 years ago

This should be fixed by https://github.com/Redth/AndHUD/commit/84c6c2ce9cf2f6fe74a0db71f85fd033f77ef8ea#diff-05d5dd85272d7cedb2e59ca16d832f52