Back to project page Arvutaja.
The source code is released under:
Apache License
If you think the Android project Arvutaja listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package ee.ioc.phon.android.arvutaja; //from www . j av a 2 s. com import android.content.Context; import android.media.MediaPlayer; import android.os.SystemClock; public class AudioCue { private static final int DELAY_AFTER_START_BEEP = 200; private final Context mContext; public AudioCue(Context context) { mContext = context; } public void playStartSoundAndSleep() { playSound(R.raw.start); SystemClock.sleep(DELAY_AFTER_START_BEEP); } public void playStopSound() { playSound(R.raw.stop); } public void playErrorSound() { playSound(R.raw.error); } private void playSound(int sound) { MediaPlayer mp = MediaPlayer.create(mContext, sound); mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { mp.release(); } }); mp.start(); } }