This post has been moved to my new blog.
Great tutorial! How do you catch an event from a non activity thread and send a message to the main activity ui thread without causing an ANR?
Comment by Jase — August 17, 2011 @ 11:35 pm
You need to create a handler on the main thread where the handlers on other threads can send messages for UI updates. This restriction or rule applied even to using a Toast from a service. So the rule of thumb to keep in mind is that any UI update has to be done in the main thread of an application. And all the activities and services uses the same main thread as long as they are running in the same process.
Comment by idlesun — August 18, 2011 @ 4:24 am
The source code zip file appears to have a file name that ends with .gif. I right-clicked on the download link and did a “save-as” and changed the extension to zip and it works fine.
Comment by williamkida — February 13, 2012 @ 8:40 pm
no it’s generate some garbage values
Comment by irfan khan — June 7, 2012 @ 6:09 am
I put the example project up on the google code: https://code.google.com/p/idlesun-android-examples/source/browse/#svn%2Ftrunk%2FTestHandler
You can do svn checkout as instructed in: https://code.google.com/p/idlesun-android-examples/source/checkout
Comment by idlesun — June 7, 2012 @ 7:22 am
how to find out the flow of handler
Comment by irfan khan — June 7, 2012 @ 6:05 am
Is your handler static for any particular reason?
Comment by anonymous — June 30, 2012 @ 10:25 pm
No specific reason. I guess you can remove it.
Comment by idlesun — July 2, 2012 @ 7:15 am
Nice Thread Tutorial, i am new in android , its help me a lot …
I have got some good links
here at androidexample.com
Comment by Android Example — February 4, 2013 @ 8:05 am
RSS feed for comments on this post. TrackBack URI
Fill in your details below or click an icon to log in:
You are commenting using your WordPress.com account. ( Log Out / Change )
You are commenting using your Twitter account. ( Log Out / Change )
You are commenting using your Facebook account. ( Log Out / Change )
You are commenting using your Google+ account. ( Log Out / Change )
Connecting to %s
Notify me of follow-up comments via email.
The Rubric Theme Blog at WordPress.com.
Get every new post delivered to your Inbox.