The error means that this Message object has already been posted to a
queue.  It probably means that somewhere you are keeping  a Message that you
received from a Handler (the Handler owns the message and will recycle it
when returning from your code), or otherwise cause a Message to get recycled
that is also being posted into a Handler.

On Tue, May 12, 2009 at 6:04 PM, radarcg <rada...@gmail.com> wrote:

>
> Ok, I'm really struggling with what is likely a simple issue. All I
> really want to do is have an activity spawn a thread to do a non-
> trivial action (for now, just testing with sleep(5000) ). Then, when
> that non-trivial action completes,  the thread should notify the
> activity, and the activity should present something visual, and
> proceed. Simple enough right? I'm trying to use a Handler subclass to
> which I send messages using sendMessage(). That handler subclass with
> then notify the activity. It all seems to work actually, but then when
> the thread completes, android is throwing an unhelpful exception:
>
>
> 05-13 00:58:14.476: ERROR/JavaBinder(1073): *** Uncaught remote
> exception!  (Exceptions are not yet supported across processes.)
> 05-13 00:58:14.476: ERROR/JavaBinder(1073):
> android.util.AndroidRuntimeException: { what=1004 when=4149225
> arg2=1 } This message is already in use.
> 05-13 00:58:14.476: ERROR/JavaBinder(1073):     at
> android.os.MessageQueue.enqueueMessage(MessageQueue.java:173)
> 05-13 00:58:14.476: ERROR/JavaBinder(1073):     at
> android.os.Handler.sendMessageAtTime(Handler.java:457)
> 05-13 00:58:14.476: ERROR/JavaBinder(1073):     at
> android.os.Handler.sendMessageDelayed(Handler.java:430)
> 05-13 00:58:14.476: ERROR/JavaBinder(1073):     at
> android.os.Handler.sendMessage(Handler.java:367)
> 05-13 00:58:14.476: ERROR/JavaBinder(1073):     at
> android.view.ViewRoot.windowFocusChanged(ViewRoot.java:2421)
> 05-13 00:58:14.476: ERROR/JavaBinder(1073):     at
> android.view.ViewRoot$W.windowFocusChanged(ViewRoot.java:2594)
> 05-13 00:58:14.476: ERROR/JavaBinder(1073):     at android.view.IWindow
> $Stub.onTransact(IWindow.java:166)
> 05-13 00:58:14.476: ERROR/JavaBinder(1073):     at
> android.os.Binder.execTransact(Binder.java:287)
> 05-13 00:58:14.476: ERROR/JavaBinder(1073):     at
> dalvik.system.NativeStart.run(Native Method)
>
> As a seasoned Java developer, running into trouble like this so early
> in a new project is frustrating. However, I believe in Android and the
> broader Google development platforms, so I'd really like to solve
> this, but I think I need the communities help. Even just some sample
> code (skeleton apps) that demo some best practices regarding the
> threading (such as usage of HandlerThread and Looper) would be a big
> help.
>
> Thanks,
>
> Charles
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~
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