You can select the Locale
to use at runtime; for example, setting it to English will result in the values from the res\values-en\...
folder being used.
To do this, the following code is necessary:
Resources res = getResources(); // From your context
DisplayMetrics dm = res.getDisplayMetrics();
Configuration conf = res.getConfiguration();
conf.locale = new Locale("en"); // For English
res.updateConfiguration(conf, dm); // Now, update the language
However, I strongly recommend against using this. When a user runs an app, they expect it to either be in the default language (which in many cases is English), or their localized language. Giving someone an app in Hindi, for example, when they are in Russia, is really no good.
Keep in mind, that if you are using en
for your entire app, getting a value from languages_hi.xml
is incredibly difficult and, really, should not be done in any situation. An application should be the same language throughout, or it will begin to confuse the user (with the exception of apps that handle translations between languages). However, if you are interested in doing this (for whatever esoteric reason), you should review this answer.
PS: I assume you know this, but I should mention it anyway. Any strings in the res\values\...
folder are used if the locale which the phone uses is not specified using res\values-xx\...
. You can find information on this here.