Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

DisplayAlert on android crash

$
0
0

Is there a way to check if the activity exists on android side of Xamarin.Forms so that calling DisplayAlert doesn't crash like this:
Java.Lang.RuntimeExceptionAttempt to invoke virtual method 'android.content.res.Resources$Theme android.content.Context.getTheme()' on a null object reference

This seems to happen when they user backgrounds the app or something when a DisplayAlert would have shown. On android proper you'd check if the activity is available.
Do I need to write an Android DependencyService to check this or is there a way to do it in Xamarin.Forms?

Thanks


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>