i want to play two files one after another on a single click of Button.Files are in assets folder .
if (play)
{ mp.stop();
mp.release();
mp = null;
}
btn1.setImageDrawable(getResources().getDrawable(R.drawable.key1));
mp = new MediaPlayer();
try {
descriptor = getAssets().openFd("c1.mp3");
descriptor1 = getAssets().openFd("d2.mp3");
mp.setDataSource(descriptor.getFileDescriptor(), descriptor.getStartOffset(), descriptor.getLength());
mp.prepare();
mp.start();
mp.setDataSource(descriptor1.getFileDescriptor(), descriptor1.getStartOffset(), descriptor1.getLength());
mp.prepare();
mp.start();
}
catch (IOException e)
{ // TODO Auto-generated catch block
e.printStackTrace();
}
play = true
Comments
Post a Comment