Back to project page AdoreLib.
The source code is released under:
MIT License
If you think the Android project AdoreLib 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 com.ylinval.adore.adorelib.Sound; /*from ww w .ja v a 2 s. c o m*/ import android.content.Context; import android.media.MediaPlayer; /** * Created by jdourlens on 5/10/14. */ public class SoundEffect { MediaPlayer mp; public SoundEffect(Context c, int id) { mp = MediaPlayer.create(c, id); } public void play() { if (mp != null) { mp.seekTo(0); mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { mp.pause(); } }); mp.start(); } } }