Android Question Opening media files in subfolder of DirAssets

Andrew Gray

Member
Licensed User
Longtime User
I'm trying to have an app play sound files that are stored in a subfolder of my project's Files folder (there are a lot of small assets associated with my project and having them all together in the root of the Files folder would make them hard to manage).

However, when I try code such as the following, the file is not recognised. (Things work fine when the sound is in the root of the folder.)

B4X:
Dim mp as MediaPlayer
mp.Initialize      
mp.Load(File.DirAssets, "mysubfolder\myfile.mp3")
mp.Play

Does MediaPlayer simply not work with files that are in subfolders? And if not, what am I doing wrong? Any help greatly appreciated.

Andrew
 

Cableguy

Expert
Licensed User
Longtime User
have you tried adding a leading slash to the file name, like "\mysubfolder\myfile.mp3" ?
 
Upvote 0

HotShoe

Well-Known Member
Licensed User
Longtime User
Linux/Android uses forward slashes"/" windows uses backslashes "\"
 
Upvote 0
Top