문제

I know that the multiple language support can be obtained by maintaining different strings.xml in folders like values , values-it('it' incase of italian) and the app will show the contents in the language which is the device's language . My question is I have my app , that people of my region would like in local language [Marathi / Hindi] . Initially I will provide screen that would allow me to choose English/Hindi/Marathi .I am struck , how to programmatically apply them !

Thanks

도움이 되었습니까?

해결책

Try to set your selected Language on this way:

Locale locale = new Locale("YourSelectedLang");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,
        getBaseContext().getResources().getDisplayMetrics());
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top