Randomly generate sound from onClick and onShake events?
Posted
by Aaron
on Stack Overflow
See other posts from Stack Overflow
or by Aaron
Published on 2010-05-11T03:19:09Z
Indexed on
2010/05/11
3:24 UTC
Read the original article
Hit count: 266
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...
© Stack Overflow or respective owner