My main issue is to find out what is really causing the BadTokenException.
Any way how to find out which code initiated the message that caused the
BadTokenException or which activity was expected to be running.

On Sun, Dec 20, 2009 at 1:03 PM, Chander Pechetty <cspeche...@gmail.com>wrote:

> As an example take the case of Market App. It doesn't give any toast
> or progress when you leave the app. Once the user leaves the app for
> whatever reason, only a notification is given if the download fails/
> succeeds.
> Any progress dialogs you have when you leave the app should be
> dismissed/cleaned up in the onPause. Depending on what kind of app
> yours is, you can either show a notification (may be from the service
> once the Task is completed, after it attempts several retries in case
> of error) using the NotificationManager, or I would just cancel the
> Task if I was using a AsyncTask.
>
> I wouldn't want a toast or progress result/or a force close  show up
> when I receive a call, or trying to use some other app; those make
> sense only when I am looking at your app.
>
>
>
> On Dec 19, 10:38 pm, Mariano Kamp <mariano.k...@gmail.com> wrote:
> > Thanks for your help here.
> >
> > I reas the bug report, but I am not quite sure what to make of it and
> what
> > the solution is.
> >
> > In my case the user enters username/password and then I show a progress
> > monitor. When the user backs out or goes to home then I still want to
> > display the result, at least when an error occurred.
> >
> > How is this to be accomplished?
> >
> > Can I somehow find out beforehand if I will run in this error and then
> use
> > some other mean, say a toast, to at least notify the user that not all is
> > good?
> >
> > On Mon, Nov 23, 2009 at 8:01 AM, Chander Pechetty <cspeche...@gmail.com
> >wrote:
> >
> > > 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 <mariano.k...@gmail.com> 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
> android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> <android-developers%2bunsubscr...@googlegroups.com<android-developers%252bunsubscr...@googlegroups.com>
> >
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

Reply via email to