I put all the songs I want to play into a hasharray. When one song
finishes it calls setOnCompletionListener by setting up,
mMediaPlayer.setOnCompletionListener(new OnCompletionListener(){
public void onCompletion(MediaPlayer mp) {
selectNextSong();
}
});
after mMediaPlayer.start(). My 'selectNextSong' method just picks a
random song from the hasharray and plays it.
That said, I would love see what you or anybody else does. Always like
to see if my wheel is rounder than yours :)
Ken
On Feb 19, 1:27 pm, MarcC <[email protected]> wrote:
> I figured this out.... no need for an array. If anyone wants to know
> the solution reply to the thread then I'll post it.
>
> On Feb 9, 3:37 pm, MarcC <[email protected]> wrote:
>
>
>
> > Trying to get one mediaplayer button to cycle through a few mp3 files.
>
> > Here is what I have so far:
>
> > First declared my array:
>
> > final int[] songs = {R.raw.ef101a, R.raw.ef101b, R.raw.ef101c,
> > R.raw.ef101d, R.raw.ef101e};
>
> > Then called MediaPlayer:
>
> > public void onClick(View arg0) {
> > MediaPlayer mp = MediaPlayer.create(efaustusa.this,
> > songs);
> > mp.start();
>
> > I cannot call the array through this mediaplayer call.... anyone know
> > how to do this?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en