views:

74

answers:

1

As a total noob to android programming I was advised to make use of adapters and handlers in order to update a textview periodically rather than thread/sleep. However, I wonder why! Any suggestions?

+1  A: 

In Android, you can't update a UI widget outside of the UI thread, so Handler provides a way for a Thread to communicate with the UI. In this approach, you start your thread to generate the view data and pass it to the Handler via a Message. The handler then updates the UI according to the data you sent.

I'm not sure exactly where an adapter would fit into the equation, since those are typically used to connect some data with a view (e.g. ListView and ListAdapter).

Erich Douglass