redth-org / AndHUD

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

AndHUD is not displaying properly in some cases. #43

Open krupanshu opened 5 years ago

krupanshu commented 5 years ago

I am using AndHUD for a long time and didn't get this kind of issue.

My project, When I am trying to display a HUD in a screen, it appears and disappears automatically.

This is happening only in 2 or 3 screens only, all other places, it is working fine.

I checked whether it is written multiple times or not, But it is happing in that activity where we are showing only one time.

Also, we are getting below error logs in our error reporting tool

Java.Interop
JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args)
Java.Interop
JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters)
Android.App
Dialog.Dismiss ()
AndroidHUD
AndHUD+<DismissCurrent>c__AnonStorey4.<>m__0 ()
AndroidHUD
AndHUD+<DismissCurrent>c__AnonStorey4.<>m__1 (System.Object state)
Android.App
SyncContext.Send (System.Threading.SendOrPostCallback d, System.Object state)
AndroidHUD
AndHUD.DismissCurrent (Android.Content.Context context)
AndroidHUD
AndHUD.showStatus (Android.Content.Context context, System.Boolean spinner, System.String status, AndroidHUD.MaskType maskType, System.Nullable`1[T] timeout, System.Action clickCallback, System.Boolean centered, System.Action cancelCallback)
AndroidHUD
AndHUD.Show (Android.Content.Context context, System.String status, System.Int32 progress, AndroidHUD.MaskType maskType, System.Nullable`1[T] timeout, System.Action clickCallback, System.Boolean centered, System.Action cancelCallback)
MyActivity+<myfunction>d__22.MoveNext ()
java.lang.IllegalArgumentException: View=DecorView@5a985e0[] not attached to window manager
android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:552)
android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:433)
android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:131)
android.app.Dialog.dismissDialog(Dialog.java:462)
android.app.Dialog.dismiss(Dialog.java:445)
mono.android.widget.AdapterView_OnItemClickListenerImplementor.n_onItemClick(Native Method)
mono.android.widget.AdapterView_OnItemClickListenerImplementor.onItemClick(AdapterView_OnItemClickListenerImplementor.java:30)
android.widget.AdapterView.performItemClick(AdapterView.java:350)
android.widget.AbsListView.performItemClick(AbsListView.java:1683)
android.widget.AbsListView$PerformClick.run(AbsListView.java:4094)
android.widget.AbsListView$10.run(AbsListView.java:6583)
android.os.Handler.handleCallback(Handler.java:789)
android.os.Handler.dispatchMessage(Handler.java:98)
android.os.Looper.loop(Looper.java:164)
android.app.ActivityThread.main(ActivityThread.java:6944)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Can you please help me how can I resolve this.

Cheesebaron commented 5 years ago

To me it looks like you are trying to dismiss the AndHUD while the Activity is not shown on the screen.

java.lang.IllegalArgumentException: View=DecorView@5a985e0[] not attached to window manager