Reputation: 2294
I have an android application that needs to display strings found under the resources, but there can be multiple strings.xml
files, i.e. strings1.xml
, strings2.xml
and so third. The string key can reside in different stringsN.xml
files, now if a key is found in lets say strings1.xml
it should be displayed without looking into the other string files with the same key.
Is it possible in android? I have done this thing in my .Net application but seems not doable in android. Infact, android gives the compilation error when I enter values against duplicate keys in multiple strings.xml files.
EDIT
The reason for doing this is, there are different clients running my application. Lets assume for clientA I added the key "company" with the value "ABC" and in my default strings.xml file there is already a default company name with the same key "company" but with the defualt value "Default Company". Now, if clientA opens my application the company name should be "ABC" and "Default Company" for clients otherthan clientA.
Upvotes: 7
Views: 5645
Reputation: 82533
No, this is not possible on Android.
You can only have duplicate resource names in different folders (values-qualifier
). Even then, the strings aren't duplicated. They are prepared for localization, and only one will be loaded at a time.
If you told us why you needed this, we could perhaps suggest a better solution.
Upvotes: 2