android-rs-glue
android-rs-glue copied to clipboard
Show a popup if the main thread panics
The app freezing or showing a black screen is not very useful and does not indicate what's wrong.
This should probably be done by overriding the default panic handler instead of using catch_panic, so that the user can override this behavior if wanted.
Unfortunately since we're calling start manually, there's no way to either override the panic handler or to use catch_panic.
In my opinion the best thing to do is try detect the words thread <main> panicked in stderr, and open a popup when it happens.
Reference: https://developer.android.com/guide/topics/ui/dialogs.html#AlertDialog