android - Is it possible to manually switch string resources at runtime? -


Let me start by describing my problem I'm working on a large Android application that has a large number of layouts and wires. (All in strings.xm). A new requirement has been made which requires the separation of some strings based on the condition on startup (it seems that all the instances of "cat" are being replaced by "dog") this position device (locale, size , Resolution, etc.): It depends only on some within business logic.

The easiest way is to create new copies of all layout files that use strings containing "cat", and use those "string" strings instead of those new layout copies. However, this is not entirely possible due to the number of layouts, as well as the future maintenance concerns of duplicate layouts.

I know that this is not a discussion platform, so I have an approach but like focusing on it, I think the problem is closely related to the normal resource configuration / locale, where the properties of the device Due to various resources are provided. Is this a way to work for my situation? The differences are known that the desired configuration is known only in runtime and there is no current resource qualifier which is understandable (for example, we can translate into French, so I do not want to pingback it). I can not even imagine my problem, though, is unique.

If there is one more approach then I should use it, although I do not want to go too far in the discussion route because that is why there is confusion on him. Frankly, it is probably risky to ask here, but I do not know where and where it is.

I can think of several solutions:

You can set the string on yourTextView.setText (R.string.any_string) :

1) You have some resource strings for business logic.
2) A,

  getResources (). GetString (R.string.tempale, "


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -