I am developing an application for Titanium, and therefore building a module from an Android application. But a module for Titanium generates a project in 开发者_JAVA技巧Android which has no autogenerated R file.
I need to load a bitmap image but as I dont have the R file so I cant access to my resources by the id. I have thought about accessing to this bitmap by path..But also struggling to do that, as I have read about something like in the Android .apk doesnt have folders...Dont really understand it to be honest.
Can I have a folder in my Android project and access to files on it with some path like @folder/resource/item.png? Then store it in an InputStream for example.
Thanks a lot. David.
We just recently added support in git (our master branch) for bundling a "res" folder with your Titanium module. If you grab a new build, you should be able to put your "res" folder under "platform" in your module, and it everything there will be automatically bundled in your app.
To access the resources under Res (since the R.java is generated for the app and not the module), we have a helper class called TiRHelper that gives you access to any resource in your module like so:
int xyz = TiRHelper.getApplicationResource("id.xyz")
精彩评论