import android.app.*; import android.media.*; import android.net.*; // do not call in ui thread. // waits until playback done. static void androidPlayMp3(Activity androidContext, File mp3) { final MediaPlayer mPlayer = MediaPlayer.create(androidContext, Uri.fromFile(mp3)); final new Flag done; mPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void onCompletion(MediaPlayer mp) { mPlayer.release(); done.raise(); } }); mPlayer.start(); done.waitUntilUp(); }