dybarsky / spots-dialog

Android AlertDialog with moving dots progress indicator
MIT License
1.08k stars 242 forks source link

Calling show throws exception #45

Closed MartHugh closed 5 years ago

MartHugh commented 5 years ago

I use the following code to show an dialog box and this works on a number of devices across lots of versions of Android from 4.4.4 to 9.0.

AlertDialog dialog = new SpotsDialog(AppGlobals.CurrentActivity, "Deregistering device...", Resource.Style.CustomSpotDialog);
dialog.Show();

However on particular device (HUAWEI MediaPad TI *.0 Pro, running Android 4.4.4), calling .Show() throws an exception:

{Java.Lang.NullPointerException: Exception of type 'Java.Lang.NullPointerException' was thrown. at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue args) [0x00069] in <8acc8089c2ed40d08469fbaa6710a44c>:0 at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue parameters) [0x0002a] in <8acc8089c2ed40d08469fbaa6710a44c>:0 at Android.App.Dialog.Show () [0x00000] in /Users/builder/data/lanes/6102/4b951a3e/source/monodroid/external/xamarin-android/src/Mono.Android/obj/Release/android-28/mcw/Android.App.Dialog.cs:2537

AppGlobals.CurrentActivity is set and appears to be valid.

Any ideas how I should proceed.

Thanks

MartHugh commented 5 years ago

Deleting and redeploying this debug App from the IDE, seems to have resolved the problem.