Hi can I have and array of int[] music = {R.raw.song1, R.raw.song2} and use the music.shuffle() ? so that I will put this method in the next button for it to shuffles to a random songs ?
Asked
Active
Viewed 202 times
1 Answers
0
hope this helps
private int getRandomSong(int[] music) {
int max = music.length - 1;
int min = 0;
int random = (new Random()).nextInt((max - min) + 1) + min;
return music[random];
}
happy coding :)
next time try to give a bit more information about the question else you will get down votes unnecessarily :)

Harkal
- 1,770
- 12
- 28