Code example for Vibrator

Methods: cancel, hasVibrator

0
		stopVibrate(); 
		stopRingtone(); 
	} 
	 
	private void stopVibrate() { 
		if(vibrator != null && vibrator.hasVibrator())
			vibrator.cancel();
	} 
	 
	private void stopRingtone() { 
		if(mediaPlayer != null) {
			mediaPlayer.reset();
			mediaPlayer.release();
		} 
	} 
	 
	@Override 
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if(keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME)
			return true; 
		return super.onKeyDown(keyCode, event);