Android Question [solved] crash during Pause (show > showAsync)

Dave O

Well-Known Member
Licensed User
Longtime User
Short version:
If you're getting crashes when you have dialogs open (e.g. msgbox, fileDialog, inputDialog, etc.) from the various versions of the Dialogs libraries, you can fix most/all of them by switching from the traditional Show method to ShowAsync.

This has been posted in various forms before, but I think it's common enough and important enough that it deserves another mention.

Longer version:
I spent today fixing crashes reported by users and by the Google Play console. Many of these happened during Activity_Pause, when i was saving data or storing temp values or other housekeeping.

Some crashes happened when I rotated the device (orientation change), so I fixed those.

But I also discovered that if a modal dialog was open when the app was paused, it caused a null error in the code following it, and crashed.

When I changed these from to xxx.showAsync, the crashes stopped. As an bonus, the keyboard also behaved better (hiding when it was supposed to.)

Moving from show to showAsync forced me to restructure some of my code (the Wait For makes the sub resumable, which can affect program flow), but that's rarely a bad thing - revising code almost always results in something cleaner. I've now added it to my list of global changes to make whenever I revise one of my apps.

Hope this helps!