Accessing files in the res folder?

I would like to access a file stored in my .apk's res folder. Is this possible? And if so how? I've tried several tings using currentApplicationFile and what not but I can't seem to locate the thing.

Have you tried "../Builds/Android/res/filename" ?

This is assuming that your reference source file is located in the "ProjectName/Source" folder.

Have you considered BinaryData ? This would make it platform-independent and probably slightly more efficient as well (access speed)

I don't see how that would work with an installed .apk which has a completely different file structure to the local project, but perhaps I'm missing something? Binary is an option but reading a simple text file would be by far the easiest solution. I'm thinking that surely someone has bundled some kind of resource files into their apk's in the past. Surely there is a way of accessing them? 

I guess one could use the GZip utility and open the .apk directly. I'll take a look. Might be the easiest way.

Hey,

I guess I have pretty much the same problem here. I'm trying to access resource files (.jpg, .svg) using


File test = File::getSpecialLocation (File::currentApplicationFile);
Logger::writeToLog(test.getFullPathName());
int nFiles = test.getParentDirectory().findChildFiles(iconFiles, File::findFiles, true, fileNameStart+"*");

 

This works perfectly fine on Ios and Windows but on Android findChildFiles returns nFiles=0. Where do I need to put the resource files to make this work?

 

If you're embedding images in your app, remember that the introjucer will do this painlessly for you via BinaryData, no need for files or messing about with resources.