我知道如何使1个按钮播放1个音频文件,但是如何使1个按钮随机播放多个声音文件?
答案 0 :(得分:0)
将所有音频的uri添加到ArrayList中,然后从中选择随机uri作为-
ArrayList<Uri> list = new ArrayList();
list.add(audio1Uri1);
list.add(audio1Uri2);
list.add(audio1Uri3);
Collections.shuffle(list);
System.out.println("" + list);
//This will give you random songs everytime. Pass the element one by one to media player. And play the next song by checking if the previous one has finished