Accessing game related files and directories on Android

I’m developing a small game for android.
There are some fonts and graphics I’m using and it’s no problem loading them with the ContentManager class.
I have the program also debugable for PC and to load in the sprites, I look inside the sprite folder and read in the sprite objects from each of the file inside the directory. Everything works fine on PC, but on Android I get an exception that it can’t find the directory (“Content\Sprites”). Where is it located and how do I access it? When I’m trying to get the directories in the default directory it returns 16 directories but “Content” is not in it, so where does it save it?

I had a similar issue moving from an iOS app to Android for the first time. In your project, you need to move your graphics, etc. to sit under the root folder Assets - in your example, the full path would now be Assets/Sprites. I don’t know whether you explicitly need a folder named Content under there but I had one already in my original projects so my content files were placed under “Assets/Content/gfx”, “Assets/Content/fonts”, etc. The Content.RootDirectory setting in my game class was simply “Content” - MonoGame seems to automatically treat Assets as the root folder for Android content.



I have changed the folder name to assets and ContentManager still loads the assets like it should.
But I still can’t find the files manually. I put an empty text file into the assets folder called text.txt but it’s not finding it (skips the breakpoints):

I have set the file to always copy and Android Asset, but changing the type to something like content doesn’t work too.

I think I got it now. These files need to be loaded with an AssetManager instance, like AssetManager.Open(string fileName). The Activity starting class has an instance of it by default, so I just forward it to where ever I want.
Thanks for trying to help :slight_smile:

MonoGame’s TitleContainer.OpenStream on Android uses AssetManager behind the scenes.