Is there are way to switch between different languages within an app using androids multilanguage support (values-de
folder for german and value-en
folder for english)?
Asked
Active
Viewed 7,168 times
13
1 Answers
14
This is not really supported but possible by changing the Configuration object's "locale" field [Google Groups Post]
Configuration c = new Configuration(getResources().getConfiguration());
c.locale = Locale.GERMAN;
getResources().updateConfiguration(c, getResources().getDisplayMetrics());
Note that this alone will only effect future strings, not ones already displayed on the screen. You'd want to do this from a different activity than your main one, then finish your main one and restart it. This is hacky. See Post from Hackborn

Kevin TeslaCoil
- 10,037
- 1
- 39
- 33
-
I will give it a try, when I get to this point in a few days. Thanks so far! – M.E. Jan 15 '11 at 10:49
-
can I change it directly ? – Mohammed Subhi Sheikh Quroush Apr 22 '13 at 15:06
-
@Kevin TeslaCoil with this I can run my APP with device language? – Skizo-ozᴉʞS ツ Jul 15 '15 at 08:40
-
This works but it’s only temporary. If anything happens that changes the configuration (such as rotating the screen) then the changes get lost. – Neil Roberts Feb 25 '17 at 21:22