There are currently few issues logged around this bug:
http://code.google.com/p/android/issues/detail?id=3953

I don't know your specific case, but was easy to fix in my case, when
I made sure that the dialogs/views/adapters that were being created
are with the right context/activity.
Pressing a back button usually finishes the activity, so if you have
created for discussion sake created an static ListAdapter and passed
it (this), an activity instance,

 this static adapter can no longer be used for showing dialogs etc.
with the previous contexts. This behaviour gets complex depending on
the launch modes/flags you set when starting an activity, and also
whether you handle back button events.

So "token
android.os.binderpr...@431d28f0 is not valid; is your activity
running? " means your activity instance is no longer in History stack,
but your are trying to use it somewhere.
Since there is no knowing when your activity got finished and the
sequence of steps that caused it, depending on different modes, you
get sporadic reports.

-Chander

On Nov 22, 1:23 pm, Mariano Kamp <[email protected]> wrote:
> Hey,
>
>   I sporadically get bug reports with a BadTokenException.
>
>   As I don't see my app in the stacktrace I am wondering how to find the
> cause of this? Any idea?
>
> Cheers,
> Mariano
>
> -- Android Version: sdk=3, release=1.5, inc=eng.root.20090719.200906
> -- Memory free: 1.01MB total: 4.01MB max: 16.00MB
> -- Custom ROM: Stock Android
> -- NewsRob Version: 3.2.9/329
> -- Stacktrace:(1178)
> android.view.WindowManager$BadTokenException: Unable to add window -- token
> android.os.binderpr...@431d28f0 is not valid; is your activity running?
> at android.view.ViewRoot.setView(ViewRoot.java:425)
> at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:178)
> at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
> at android.view.Window$LocalWindowManager.addView(Window.java:392)
> at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2674)
> at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2287)
> at android.app.ActivityThread.access$1800(ActivityThread.java:112)
> at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
> at android.os.Handler.dispatchMessage(Handler.java:99)
> at android.os.Looper.loop(Looper.java:123)
> at android.app.ActivityThread.main(ActivityThread.java:3948)
> at java.lang.reflect.Method.invokeNative(Native Method)
> at java.lang.reflect.Method.invoke(Method.java:521)
> at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
> at dalvik.system.NativeStart.main(Native Method)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to