cr5315
Android Enthusiast
I have an app that plays a sound when it is opened, but I would like it to repeat until the app is closed. I've gotten the sound to play once, but I can't figure out how to make it repeat.
Code:
import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
public class ObeyActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final MediaPlayer mp = MediaPlayer.create(getBaseContext(), R.raw.laugh);
mp.start();
}
}