"android.view.WindowManager $ BadTokenException: Failed to add window token android.view.ViewRootImpl$W@41d51058 is invalid;"

I have an EditText inside a PopupWindow that displays correctly, when the keyboard is touched the SoftInput is open, if there is a misspelled word in the field, it will have a red underline on it if it touches the next exception.

06-12 16:05:46.136: E/AndroidRuntime(10375): android.view.WindowManager$BadTokenException: Unable to add window -- token android.view.ViewRootImpl$W@41d51058 is not valid; is your activity running?
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.view.ViewRootImpl.setView(ViewRootImpl.java:769)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:278)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.widget.PopupWindow.invokePopup(PopupWindow.java:1067)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.widget.PopupWindow.showAtLocation(PopupWindow.java:891)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.widget.PopupWindow.showAtLocation(PopupWindow.java:855)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.widget.Editor$PinnedPopupWindow.updatePosition(Editor.java:2722)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.widget.Editor$PinnedPopupWindow.show(Editor.java:2670)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.widget.Editor$SuggestionsPopupWindow.show(Editor.java:2921)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.widget.Editor.showSuggestions(Editor.java:2063)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.widget.Editor$1.run(Editor.java:1896)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.os.Handler.handleCallback(Handler.java:733)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.os.Handler.dispatchMessage(Handler.java:95)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.os.Looper.loop(Looper.java:136)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at android.app.ActivityThread.main(ActivityThread.java:5479)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at java.lang.reflect.Method.invokeNative(Native Method)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at java.lang.reflect.Method.invoke(Method.java:515)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
06-12 16:05:46.136: E/AndroidRuntime(10375):    at dalvik.system.NativeStart.main(Native Method)

      

I found on StackOverflow that PopupWindow cannot be the parent of another, but I have no way of controlling the keyboard software to use a valid context.

How can I avoid this error?

PS: happens on Android 4.4.2+ where there is auto-completion check on keyboard

+3
android input android-popupwindow


source to share


No one has answered this question yet

Check out similar questions:

278
Android 1.6: "android.view.WindowManager $ BadTokenException: Unable to add window - null token not for application"
4
Embed android bottom sheet in adapter class recycliewiew
3
BadTokenException: Unable to add null window token; is your activity working? in activity.isFinishing statment
0
Unable to add window android.view.ViewRootImpl$W@5ccfc1d - permission denied for window type 2002
0
android.view.windowmanager $ badtokenexception cannot add window - null token is not for application
0
android.view.WindowManager $ BadTokenException
0
android.view.WindowManager $ BadTokenException error while showing PopOver
0
Android.view.WindowManager $ BadTokenException:
-2
I got an activity crash. When I get data from Firebase realtime database. I mention the exception below and my MainActivity code
-3
PopupWindow: Editext typing error showing bad marker error in android?



All Articles
Loading...
X
Show
Funny
Dev
Pics