This is the error log:
03-07 11:33:07.474: E/AndroidRuntime(5612): FATAL EXCEPTION: main
03-07 11:33:07.474: E/AndroidRuntime(5612): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@45b69850 is not valid; is your activity running?
03-07 11:33:07.474: E/AndroidRuntime(5612): at android.view.ViewRootImpl.setView(ViewRootImpl.java:567)
03-07 11:33:07.474: E/AndroidRuntime(5612): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:246)
03-07 11:33:07.474: E/AndroidRuntime(5612): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
03-07 11:33:07.474: E/AndroidRuntime(5612): at android.app.Dialog.show(Dialog.java:281)
And I know it is because of bad reference, I get the context through getContext() method(The dialog is not in any activity)
So I can't use XXXActivity.this to get the right context. so what should I do?
I also faced the same problem.I have used tab bar for this Just put getParent() instead of youractivity.this.
I hope this will help someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With