Randomly generate sound from onClick and onShake events?
- by Aaron
I've literally looked everywhere on the net and found very little
clarification on how to do this.
Pretty much, I have 8 sound files laid out in an array.xml file and I
need to play a randomly chosen file ONCE per or onClick or onShake.
First off, what technique should I use to achieve this? ARRAY-RANDOM-
STRING-PLAY? RANDOM INT-PLAY? RANDOM INT-STRING-PLAY? Any kind
of direction will help greatly cause I'm almost 3 weeks worth of
research into this.
*NOTE:
MediaPlayer mp = MediaPlayer.create(JelloMan.this,
R.raw.sound)
...is what I'm stuck on being you can't replace the "R.raw" part with a string...