Hi, I'm developing an app and I added a settings screen to allow users to 
change the language of the strings literals of the app.

In the onCreate method of the activities I use the following code:

SharedPreferences settings = getSharedPreferences(PREFS_FILE, 0);
String language = settings.getString(PREF_LANGUAGE, "en");

Locale locale = new Locale(language);
Locale.setDefault(locale);

Configuration config = new Configuration();

config.locale = locale;

getResources().updateConfiguration(config, getResources().getDisplayMetrics());


but config.locale and getResources().updateConfiguration are deprecated. 
How should I implement that functionality?

Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/d149b1f9-64e2-4b8d-8944-dada7e7b9c12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to