我想重复播放音频。因此,如果首先单击按钮音频播放,并且第二次单击相同按钮重复相同的音频而不停止我怎样才能做到这一点?这是我尝试过的:
if (mp != null){
mp.stop();
try {
mp.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mp.seekTo(0);
mp = null;
}
else {
mp = MediaPlayer.create(Takbiratul_Ihram.this, R.raw.takbir_cowok);
mp.start();
mp.setOnCompletionListener(new OnCompletionListener(){
public void onCompletion (MediaPlayer arg0){
mp = null;
}
});