Пример 1:
Handler threadHandler=new Handler();
threadHandler.postDelayed(new Runnable() {
public void run() {
// do your task here ..it will execute after 100 ms in separate thread
}
}, 100L);
Пример 2:
final Handler mHandler = new Handler(Looper.getMainLooper());
new Thread(){
/* (non-Javadoc)
* @see java.lang.Thread#run()
*/
@Override
public void run() {
// do your task here.. it will execute in seperate thread
// you can post your result from here using mHandler.post Method.
}
}.start();
В Интернете доступно множество учебных пособий.Вы можете найти это очень легко.
см. это:
http://mindtherobot.com/blog/159/android-guts-intro-to-loopers-and-handlers/