Android Question Exception java.lang.IllegalArgumentException: View not attached to window manager

Douglas Farias

Expert
Licensed User
Longtime User
Hi all.
i m using progressdialogshow2 on the app start, on activity create later loadlayout.
its a simple dialog
B4X:
Activity.LoadLayout("1")
    ProgressDialogShow2("Loading Settings...",False)

later with a timer i close this
B4X:
Sub tcarrega_Tick
    tcarrega.Enabled = False
    ProgressDialogHide
End Sub

And i see a lot of errors like this on Firebase Console.


Exception java.lang.IllegalArgumentException: View not attached to window manager
android.view.WindowManagerGlobal.findViewLocked (WindowManagerGlobal.java:403)
android.view.WindowManagerGlobal.removeView (WindowManagerGlobal.java:295)
android.view.WindowManagerImpl.removeView (WindowManagerImpl.java:79)
android.app.Dialog.dismissDialog (Dialog.java:323)
android.app.Dialog.dismiss (Dialog.java:306)
anywheresoftware.b4a.Msgbox.dismissProgressDialog (Msgbox.java:106)
anywheresoftware.b4a.keywords.Common.ProgressDialogHide (Common.java:587)
anywheresoftware.b4a.keywords.Common.ProgressDialogShow2 (Common.java:579)
bolsafamilia.app.id.main._activity_create (main.java:384)
java.lang.reflect.Method.invokeNative (Method.java)
java.lang.reflect.Method.invoke (Method.java:511)
anywheresoftware.b4a.BA.raiseEvent2 (BA.java:169)
bolsafamilia.app.id.main.afterFirstLayout (main.java:102)
bolsafamilia.app.id.main.access$000 (main.java:17)
bolsafamilia.app.id.main$WaitForLayout.run (main.java:80)
android.os.Handler.handleCallback (Handler.java:725)
android.os.Handler.dispatchMessage (Handler.java:92)
android.os.Looper.loop (Looper.java:137)
android.app.ActivityThread.main (ActivityThread.java:5041)
java.lang.reflect.Method.invokeNative (Method.java)
java.lang.reflect.Method.invoke (Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:817)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:584)
dalvik.system.NativeStart.main (NativeStart.java)



I found the error on stackoverflow
http://stackoverflow.com/questions/...exception-view-not-attached-to-window-manager


What can cause this error? and what can i make to fix this? i see on stackoverflow the method
isShowing maybe this help to hide the progress but it dont exist here.

what can i make to fix this? thx
 
Top