1. Check out our companion app, Forums for Android! Download from Google Play

Play random sound from big list

Discussion in 'Application Development' started by pikaachi, Oct 11, 2010.

  1. pikaachi

    pikaachi New Member
    Thread Starter
    5

    Oct 11, 2010
    1
    0
    5
    In my res/raw folder, I have many .wav files. I want my program to choose a random sound clip from my res/raw folder and play it when I click a button.

    I know a way to do it by hard coding the .wav IDs, auto-generated in the R class. But I just have too many .wav files to manually type each ID :(

    I spent hours researching about this but I have no idea. Any help will be appreciated. Thanks!

    EDIT: The .wav files do not have to be in the res/raw folder. I can move it inside assets folder if it makes things easier...
     

    Advertisement

  2. JiMMaR

    JiMMaR Well-Known Member
    53

    Jun 12, 2010
    363
    57
    53
    from my testing , .wav files didn't work on my phone
    use mp3 or ogg (ogg is better)

    I know this is not your question here, but thought I'd mention it :D
     

Share This Page

Loading...