tags:

views:

34

answers:

2

I'm wondering if it is possible to create a separate APK file which contains only language specific strings and somehow persuade my program to try to read the string resources first from that package's resource and then from the program's own resources... I would like to have a main program with 2-3 mayor laguages and the rest of the languages would go into a separate language pack. (This is to keep the main program size small as I have already 12 translations)

A: 

You can access another APK's resources through the PackageManager and getResourcesForApplication(). That will allow you to access those strings.

CommonsWare
Thanks. If I use the getString method, I can include this fallback in my program without a problem (ie. try the other app first if available). However I'm not sure how to use this if my application uses other resources that automatically use translated strings. i.e. if I expand a view, a settings screen or a menu, that XML already contains references to sting IDs and those resources are automatically resolved by the op system). Maybe I should have asked: Is there a way to set which resource object is used by default for resource lookup? I will download the android sources and do some research.
Rudolf
"Is there a way to set which resource object is used by default for resource lookup?" -- I don't think so, sorry.
CommonsWare
A: 

Look at this tutorial page for using library resources - it may help you acheive a shared resources model. Note that android SDK 2.0 and pre-1.5 are not capable of creating libraries for some reason. http://developer.android.com/guide/developing/eclipse-adt.html#libraryProject

stinkbutt