关于 Handler 的postDelayed(r, delayMillis);

private Handler mHander = new Handler(){
public void handleMessage(Message msg) {
switch (msg.what) {
case i1:

break;

default:
break;
}
}; [/size]
};
class MyThread implements Runnable{

@Override
public void run() {
for(int i=0;i<4;i++){
Log.i(TAG, "MyThread run is " + i);
}
}
}

    @Override[size=large]

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mHander.postDelayed(new MyThread(), 3000);
    }

1。此方法,会把传递给postDelayed方法中的Runnable对象在指定的时间后执行,并且是在此
   Handler所关联的线程中执行,它会把Runnable加到消息队列中,但是不会触发       HandleMessage 方法的执行。

你可能感兴趣的:(handler)