I am having Problem in playing multiple mp3 files in MediaPlayer for android ...It plays all files together and creates mess.I want the solution that it just play each file
I did this by following code:
private ArrayList mPlayerList = new ArrayList();
public void playSound4FileList(ArrayList fileList)
{
mPlayerList.clear();
for (String fileName : fileList)
{
try {
MediaPlayer mPlayerT = new MediaPlayer();
AssetFileDescriptor descriptor = context.getAssets().openFd(fileName);
mPlayerT.setDataSource(descriptor.getFileDescriptor(), descriptor.getStartOffset(), descriptor.getLength());
descriptor.close();
mPlayerT.prepare();
mPlayerT.setVolume(1f, 1f);
mPlayerT.setLooping(false);
mPlayerList.add(mPlayerT);
} catch (Exception e) {
}
}
for (int i=0; i