Code example for TimerTask

Methods: cancel

0
			if (timer == null) { 
				timer = new Timer("AlertDialog-Timer"); 
			} 
 
			if (this.dismissTask != null) { 
				this.dismissTask.cancel(); 
				this.dismissTask = null; 
			} 
 
			this.dismissTask = new TimerTask() { 
				public void run() { 
					if (System.currentTimeMillis() > stopTime) {
						dismiss();
					} else { 
						layoutTimer.getHandler().post(dismissRunnable);
					} 
				} 
			}; 
			timer.schedule(this.dismissTask, 0, 1000); 
		} else { 
			if (this.dismissTask != null) {