Code example for Timer

Methods: cancel, purge

0
 
			@Override 
			public void run() { 
				setVolume(mLeftVolume + 0.1f, mRightVolume + 01.f);
				if (mLeftVolume >= 1.0f || mRightVolume >= 1.0f) {
					timer.cancel();
					timer.purge();
				} 
			} 
 
		}; 
 
		timer.schedule(timerTask, 200, 200);
	} 
 
	@Override 
	public void pause() throws IllegalStateException { 
		if (mCurrentPlayer == this) {
			super.pause(); 
		} else { 
			mCurrentPlayer.pause();