1. Download our Official Android App: Forums for Android!

Apps Play random sound from big list

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

  1. pikaachi

    pikaachi Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    Oct 11, 2010

    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 Android Enthusiast
    Rank:
    None
    Points:
    53
    Posts:
    363
    Joined:
    Jun 12, 2010

    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...