Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.media.MediaPlayer; import android.media.MediaPlayer.OnCompletionListener; public class Main { public static void playSoundfile(Context context, int R_raw_fileid) { MediaPlayer mp = MediaPlayer.create(context, R_raw_fileid); mp.setOnCompletionListener(new OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { mp.release(); } }); mp.start(); } }