I am designing an App for android that requires various short music files to be played on after each other.
I have set up an "onClick" listener to run a loop that plays each of these sound files over and over, they may be played over 100 times.
BUT
I need the user to be able to interact with the app while it plays, which it cannot at this moment in time, the loop runs and basically the device is frozen until the music files have completed playing.
Any pointers to a helpful solution?
Loop is basically:
mPlayButton.setOnClickListener(new View.OnClickListener() {
@Override
public synchronized void onClick(View v) {
for(char i: method.toCharArray()){
mPlayer.play(getActivity(),Integer.parseInt(Character.toString(i)));
try {
wait(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
});