Search code examples
androidsoundpool

File in assets folder needs a resId to be used


I am new to Android, so this is probably a dumb question.

I have a sound file in my assets folder:

app|assets|www|sounds|hooray.ogg

Now I want to load it into my SoundPool

// THIS IS NOT RIGHT and is underlined in wavy error-red
mySoundPool.load(m_Context,
                "file:///android_asset/www/sounds/hooray.ogg",
                1);

It is saying the "file:///android..." etc should be a resId.

How do I assign a resId to this file?


Solution

  • How do I assign a resId to this file?

    You can't. A resource ID is for resources, not assets.

    Either: