Unable to add window -- token android.os.BinderProxy@1856e19f is not valid; is your activity running

Hi,
I am getting the following exception in my android activity :
android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@1856e19f is not valid; is your activity running?
       at android.view.ViewRootImpl.setView(ViewRootImpl.java:579)
       at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:272)
       at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3071)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2393)
       at android.app.ActivityThread.access$800(ActivityThread.java:148)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5312)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)

Open in new window


Please help what could be the reason for this.

Thanks
Rohit BajajAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris Harte2015 Top Expert (Most Article Points)Commented:
This usually happens when you try to create a pop up window, such as a dialog and there is a problem with the lifecycle. eg the current activity cannot be reliably passed to the window. What is it you are trying to do?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Android

From novice to tech pro — start learning today.