[android-developers] Re: Threading and Message Loops
I replaced my threading code with the AsyncTask, and its such a direct solution for my issue that I don't need to post my code. The references listed above provided all the solutions. Also, the stacktrace also seemed to be caused by the reason stated above because it too went away with this solution. Thanks again! On May 13, 1:37 pm, radarcg wrote: > Thanks to you both for this information, it sounds like its exactly > what I was looking for. It is appreciated, thanks for your > contributions to the community. I'll pay back by posting results... > > On May 12, 6:41 pm, Dianne Hackborn wrote: > > > > > 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: Threading and Message Loops
Thanks to you both for this information, it sounds like its exactly what I was looking for. It is appreciated, thanks for your contributions to the community. I'll pay back by posting results... On May 12, 6:41 pm, Dianne Hackborn wrote: > 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 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 -~--~~~~--~~--~--~---
[android-developers] Threading and Message Loops
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 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Android, Google Accounts, and Google App Engine
Is it possible for an android application (NOT mobile website) to access the authentication token that already exists, and pass it do a web application that is hosted on the Google App Engine? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Android Application with Google App Engine
Is it possible to have an android application (NOT mobile website) "sign-in" as a user to a web application hosted on the Google App Engine? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---