Issue
I can save .mp3 files in the raw folder, access them by id then play them using a media player
MediaPlayer.create( getApplicationContext(), R.raw.sound1 )
However my app has 200+ sounds so I want to organise them into folders. I have created subdirectories in the raw folder, but I can't access them by ID.
This does not work
MediaPlayer.create( getApplicationContext(), R.raw.group1.sound1 )
How should I separate different types of sound so that my app is maintainable?
Solution
You cannot have subdirectories of resource directories. Use a naming convention instead.
So, instead of trying to have res/raw/group1/sound1.mp3
, use res/raw/group1_sound1.mp3
, and request R.raw.group1_sound1
.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.