Android Question Getting the uri of a file in the app's assets folder

rleiman

Well-Known Member
Licensed User
Longtime User
Greetings,

I would like to get the uri of a file that resides in my app's assets folder. Can you point me to a link that describes how it's done?

I saw many posts on the forum that shows code like this but none of the posts actually shows the coding behind GetFileUri sub routine.

B4X:
Log(GetFileUri(File.DirAssets & "/my_music.mp3"))

Thanks.
 

JohnC

Expert
Licensed User
Longtime User
You can not share any files from the asset folder directly.

You need to modify your app to be a file provider and then copy the file from the asset folder to the shared directory, then create a URI to the file in the shared directory, then you can share it:

 
Upvote 0
Top