in titanium, is it possible to access the 3rd-party-jar-bundled resource files( xml ) from an android module? in titanium, is it possible to access the 3rd-party-jar-bundled resource files( xml ) from an android module? android android

in titanium, is it possible to access the 3rd-party-jar-bundled resource files( xml ) from an android module?


(fast & short answer: put the resources files as part of your "Titanium" project, but not put them into the "module". If you insist putting them into the "module", read on.)

Finally, I got the answer.

The official document is correct, just put the 3rd-party-jar's resource files( res folder of a native android project) under titanium module's android/platform/android folder. that's it!

e.g. my module project structure is shown as below:

# name: test_ti_module_qq_login:android  \--assets  \--build  \--dist  \--lib  \--libs  \--src  \--platform     \--android        \--res    # just put the resources here in your module!            \--drawable           \--drawable-hdpi           \--drawable-xhdpi           \--layout           \--valuesassetsdocumentationexampleLICENSE... 

and FYI, the native android resource folder looks like:

# A native Android project structure   ▸ assets/          ▸ bin/             ▸ gen/             ▸ libs/           ▾ res/     # these are the bundled resource files  ▸ drawable-hdpi/       ▸ drawable-xhdpi/      ▸ layout/       ▸ values/      ▸ src/       

The root cause that why Titanium kept showing the resource files missing is that I missed some of the resource files. (but it's a bit straight that the native code demo could be run without errors, whatever, finally I got the solution )

addition:

It seems that many people met the same problem? I will open source my project in these days.


Updating with based on the new information. To get that to work you would just need to merge the res folder from github into your platforms/android/res folder. Then when you compile your module as normal.

===========================

If you're accessing from within the module in java, try using TiRHelper.getApplicationResource for things you're providing.

So for example if you've added:

platforms/android/values/strings.xmlhello!

The call would be

TiRHelper.getApplicationResource("string.helloworld");

Class Srouce

Javadoc

If you've found this helpful, please up vote. If not let me know so I can adjust.