Ray's playground

 

Dealing with Threads(Beginning Android)

Getting Through the Handlers
  The most flexible means of making an Android-friendly background thread is to create an instance of a Handler subclass. You only need one Handler object per activity, and you do not need to manually register it or anything—merely creating the instance is sufficient to register it with the Android threading subsystem.
  Your background thread can communicate with the Handler, which will do all of its work on the activity’s UI thread. This is important because UI changes, such as updating widgets, should only occur on the activity’s UI thread. You have two options for communicating with the Handler: messages and Runnable objects.

posted on 2010-01-30 23:00  Ray Z  阅读(264)  评论(0编辑  收藏  举报

导航