Java Question Unable to add window

XverhelstX

Well-Known Member
Licensed User
Longtime User
Hey,

I'm receiving the following error:

android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
at android.view.ViewRoot.setView(ViewRoot.java:550)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
at android.app.Dialog.show(Dialog.java:241)
at org.brickred.socialauth.android.SocialAuthAdapter$3$1.run(SocialAuthAdapter.java:372)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3701)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
at dalvik.system.NativeStart.main(Native Method)

The following code gives the error:
B4X:
public void Authorize(Provider provider) {
      adapter.authorize(ba.applicationContext, provider);
   }

When I try it on an activity context:

B4X:
ba.activity

Then i have a nullpointer.

Any help?

Tomas
 
Top