线程
new Thread(new Runnable() { public void run() { //sleep设置的是时长 Thread.sleep(1000); handler.sendMessage(); } }).start
延时器
TimerTask task = new TimerTask() { @Override public void run() { MotionEvent event = MotionEvent.obtain(195534905, 195534905, MotionEvent.ACTION_DOWN, 549, 867, 0); webView.onTouchEvent(event); } }; Timer timer = new Timer(); timer.schedule(task, 3000);
Android消息处理, 推荐使用这种方式
new Handler().postDelayed(new Runnable()) { public void run() { //要执行的任务 } }, delay);