ребята, у меня есть следующий код
MediaPlayer mp = new MediaPlayer();
MediaPlayer rp = new MediaPlayer();
MediaPlayer rpp = new MediaPlayer();
case R.id.bok:
i = 0;
time = Integer.valueOf(noOfTimes.getText().toString());
System.out.println("got the value" + time);
mp = MediaPlayer.create(this, R.raw.startup_converted);
mp.start();
if (skipintro.isChecked()) {
//String path = "/sdcard/varun/audio.mp3";
Runnable r1 = new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
try {
rp.reset();
rp.setDataSource("/sdcard/varun/audio.mp3");
rp.prepare();
rp.start();
System.out.println("played once");
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
handler.postDelayed(r1,mp.getDuration()+1000);
//sdcard.start();
rp.setOnCompletionListener(new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
// TODO Auto-generated method stub
System.out.println("no of times is "+time);
System.out.println("i value is "+i);
if(i < time-1){
System.out.println("inside no of times is "+time);
System.out.println("inside i value is "+i);
try {
rp.reset();
rp.setDataSource("/sdcard/varun/audio.mp3");
rp.prepare();
rp.start();
System.out.println("playing=== a");
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
i++;
}
});
ok.setEnabled(false);
rpp = MediaPlayer.create(this, R.raw.conclution);
hand1.postDelayed(new Runnable() {
public void run() {
// TODO Auto-generated method stub
rpp.start();
}
}, mp.getDuration()+ time * rp.getDuration());
handler.postDelayed(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
ok.setEnabled(true);
}
},mp.getDuration()+time* rp.getDuration()+rpp.getDuration());
я получаю ошибку (1, -4)
03-02 16:45:19.249: W/System.err(14450): java.io.IOException: Prepare failed.: status=0x1
03-02 16:45:19.267: W/System.err(14450): at android.media.MediaPlayer.prepare(Native Method)
03-02 16:45:19.295: W/System.err(14450): at samcomm.myhealth.management.Relaxation$3.run(Relaxation.java:242)
03-02 16:45:19.315: W/System.err(14450): at android.os.Handler.handleCallback(Handler.java:587)
03-02 16:45:19.326: W/System.err(14450): at android.os.Handler.dispatchMessage(Handler.java:92)
03-02 16:45:19.335: W/System.err(14450): at android.os.Looper.loop(Looper.java:123)
03-02 16:45:19.335: W/System.err(14450): at android.app.ActivityThread.main(ActivityThread.java:4363)
03-02 16:45:19.345: W/System.err(14450): at java.lang.reflect.Method.invokeNative(Native Method)
03-02 16:45:19.365: W/System.err(14450): at java.lang.reflect.Method.invoke(Method.java:521)
03-02 16:45:19.377: W/System.err(14450): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-02 16:45:19.377: W/System.err(14450): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-02 16:45:19.385: W/System.err(14450): at dalvik.system.NativeStart.main(Native Method)
пожалуйста, помогите мне