Simple trouble with Makedir on DirRootExternal

MDEnt

Member
Licensed User
Longtime User
Hello - I'm stumped with a simple problem. I've been away from Android dev for a bit and am having difficulty with creating a dir on my Galaxy S4.

When clicking an entry in a list view I execute:

B4X:
File.MakeDir(File.DirRootExternal,"/MyRingtones")
File.Copy(File.DirAssets,newPosition & ".mp3",File.DirRootExternal & "/MyRingtones",newPosition & ".mp3")
RMS = RM.AddToMediaStore(File.DirRootExternal & "/MyRingtones", newPosition & ".mp3",STB, True, True, True, True)

but get a popup for java.io.FileNotFoundException ... open failed.... ENOENT .... (No such file or directory)

When browsing with Astro I can see that the directory is not being created. I can't figure out why...

I am using android-10 as the platform.

Thanks in advance for any help.
 

MDEnt

Member
Licensed User
Longtime User
Just gave it a try - same error - and I also notice without the slash it gives a file path as storage/emulated/0MyRingtones in the error message, so I'm thinking the slash is needed.
 
Upvote 0

MDEnt

Member
Licensed User
Longtime User
Is it possible to load an mp3 into the media store from DirAssets?

I was following the example below in the documentation by replacing DirRootExternal with DirAssets. The attached image is the error I was getting - which led me to try to make a folder on DirRootExternal and copy the file there - and then add to media store - which led me to errors I opened this thread with.

B4X:
u = r.AddToMediaStore(File.DirRootExternal, "bounce.mp3", "Bounce!", True, True, True, True)

Untitled-2.jpg
 
Upvote 0

MDEnt

Member
Licensed User
Longtime User
Yes it is checked - and saw in a thread to possibly add this line to the manifest - which I did - with no change in behavior...

B4X:
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
 
Upvote 0

MDEnt

Member
Licensed User
Longtime User
Nice - that did it- thanks! I was thinking the check would prevent something from overwriting my changes - but I guess it allows to overwrite a default manifest file?
 
Upvote 0
Top