Basic Sound Player Using Tutorial

1. The following is the sample code of using audio sound in application:

final MediaPlayer presssoundyes = MediaPlayer.create(PressMax.this,R.raw.beep);
if(presssoundyes.isPlaying())
				{
					presssoundyes.seekTo(0);
				}
				else
				{
					presssoundyes.start();
				}

Happy playing 🙂

Advertisements

Basic CountDown Timer Using Tutorial

1. The following is the sample code of using countdown timer:

       final CountDownTimer timer = new CountDownTimer(10000,100) {
			
			@Override
			public void onTick(long millisUntilFinished) {
				textviewtime.setText("Time: "+millisUntilFinished+"(ms)");
		
			}
			
			@Override
			public void onFinish() {				
				flagTimeFinish=1;

			}
		};

Happy countdowning 🙂