Reputation: 2814
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?
Upvotes: 0
Views: 147
Reputation: 1006614
How do I assign a resId to this file?
You can't. A resource ID is for resources, not assets.
Either:
Move this file to app/src/main/res/raw/hooray.ogg
and then use R.raw.hooray
as your resource ID, or
Use getAssets().openFd("www/sounds/hooray.ogg")
to get an AssetFileDescriptor
, then pass that to a different version of the load()
method on your SoundPool
Upvotes: 1