2 messages in com.googlegroups.android-beginnersHandler doesn't create New Threads?
FromSent OnAttachments
jtaylor29 Jan 2008 08:14 
jtaylor29 Jan 2008 16:21 
Subject:Handler doesn't create New Threads?
From:jtaylor (juan@gmail.com)
Date:01/29/2008 08:14:32 AM
List:com.googlegroups.android-beginners

"Handler is actually a better choice than Timer for another reason too. The Handler runs the update code as a part of your main thread, avoiding the overhead of a second thread and also making for easy access to the View hierarchy used for the user interface. Just remember to keep such tasks small and light to avoid slowing down the user experience."

A Stitch in Time, Android Developers Blog http://android-developers.blogspot.com/2007/11/stitch-in-time.html

I thought a runnable put into a Handler was supposed to create a new thread? Putting a message into a handler just passes the Message from one thread to another? I'm not certain what the "A Stitch in Time" Example is saying when it says the Handler "runs the update code as part of the main thread". Isn't the "update code" the runnable? Which creates a new thread?

"When a process is created for your application, its main thread is dedicated to running a message queue that takes care of managing the top-level application objects (activities, intent receivers, etc) and any windows they create. You can create your own threads, and communicate back with the main application thread through a Handler. This is done by calling the same post or sendMessage methods as before, but from your new thread. The given Runnable or Message will than be scheduled in the Handler's message queue and processed when appropriate."

android.os.Handler