定时器

实现activity的定时跳转。


上代码。


//定时跳转
		final Intent it = new Intent(this, TestActivity.class); //你要转向的Activity
		  
		  Timer timer = new Timer();
		  TimerTask task = new TimerTask() {
		   @Override
		   public void run() {
		    startActivity(it); //执行
		   }
		  };
		timer.schedule(task, 1000 * 10); //10秒后


你可能感兴趣的:(timer)