In principle, I have 3 songs, and I want the user to be able to return to the first song after completing a cycle of 3 songs. Why won't it work? It will play all 3 songs, then the fourth click does not play any song.
MediaPlayer song0, song1, song2; Button play, next; ArrayList<MediaPlayer> music = new ArrayList<MediaPlayer>(); int track = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); song0 = MediaPlayer.create(TheParty0Activity.this, R.raw.blacksunempire); song1 = MediaPlayer.create(TheParty0Activity.this, R.raw.blueskies); song2= MediaPlayer.create(TheParty0Activity.this, R.raw.fuckingnoise); music.add(song0); music.add(song1); music.add(song2); play = (Button) findViewById(R.id.button0); next = (Button) findViewById(R.id.button1); play.setOnClickListener(new View.OnClickListener() { public void onClick(View v) {
source share