There are numerous reports of the same exception. All point to some view that is using a wrong Context See examples below and try to find where in your Activity are doing something similar: groups.google.com/group/android-develope... anddev.org/view-layout-resource-problems... Android: ProgressDialog.show() crashes with getApplicationContext Android 1.6: "android.view. WindowManager$BadTokenException: Unable to add window -- token null is not for an application Check at the setView(...) method in the ViewRoot.
Java code. It may help you figure out: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.2_r1.1/android/view/ViewRoot.java#ViewRoot.setView%28android.view.View%2Candroid.view.WindowManager.LayoutParams%2Candroid.view.View%29 Specially, the lines: case WindowManagerImpl. ADD_BAD_SUBWINDOW_TOKEN: throw new WindowManagerImpl.
BadTokenException( "Unable to add window -- token " + attrs. Token + " is not valid; is your activity running? ").
There are numerous reports of the same exception. All point to some view that is using a wrong Context. See examples below and try to find where in your Activity are doing something similar: groups.google.com/group/android-develope... anddev.org/view-layout-resource-problems... Android: ProgressDialog.show() crashes with getApplicationContext Android 1.6: "android.view.
WindowManager$BadTokenException: Unable to add window -- token null is not for an application" Check at the setView(...) method in the ViewRoot. Java code. It may help you figure out: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.2_r1.1/android/view/ViewRoot.java#ViewRoot.setView%28android.view.View%2Candroid.view.WindowManager.LayoutParams%2Candroid.view.View%29 Specially, the lines: case WindowManagerImpl.
ADD_BAD_SUBWINDOW_TOKEN: throw new WindowManagerImpl. BadTokenException( "Unable to add window -- token " + attrs. Token + " is not valid; is your activity running?").
Thanks for the info. Unfortunately these all seem to be related to the same bug: calling getApplicationContext() and passing that as context to a Dialog.show. That does not appear to be my issue.
Moreover, the fact that none of my application code is on the stack is confusing; I would expect to see my code on the stack. – esilver May 3 at 20:29 Yes, that lack in the stack is what prevents us to reach a conclusion. I'm looking at the last line in the stack before the exception: at android.view.ViewRoot.
SetView(ViewRoot. Java:527) which hints me to an onDraw() or onStart() method trying to inflate the View. – Aleadam May 3 at 20:36 Right, so effectively line 497 of ViewRoot (bit.Ly/itqRiP) is returning WindowManagerImpl.
ADD_BAD_SUBWINDOW_TOKEN or WindowManagerImpl. ADD_BAD_APP_TOKEN. I just checked and all my onStart methods do is call FlurryAgent.
OnStartSession(this, Constants. FlurryClientId). I have no onDraw methods.
It is certainly possible that flurry is throwing; however, I just did a test where I did a DivideByZero exception in my onStart method and it does it fact appear on the stack. Thus, I don't think it is flurry throwing an exception in this case. – esilver May 3 at 21:05 One curious thing: I am unsuccessful in my attempts to repro that exact same stack; specifically I don't see handleRelaunchActivity on the stack when I put a view in the background and then restore it by clicking on the application icon.
Looking at this thread: stackoverflow. Com/questions/4466529/… I wonder if there may in fact be some unrelated exception earlier that is triggering a "relaunch" which itself fails? – esilver May 3 at 21:17 But wouldn't you see the stack of that "unrelated exception" first?
Perhaps the activity gets killed? – Aleadam May 3 at 21:26.
WindowManager$BadTokenException: Unable to add window -- token android.os. BinderProxy@405177d8 is not valid; is your activity running? File crashLogDirectory = new File(Environment.
GetCanonicalPath() + Constants.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.