Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Configuration conf = getResources().getConfiguration();
- conf.locale = new Locale("es") // Deprecated
- String language = conf.locale.getDisplayName() //Deprecated
- Locale locale;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- locale = context.getResources().getConfiguration().getLocales().get(0);
- } else {
- locale = context.getResources().getConfiguration().locale;
- }
- Configuration conf = getResources().getConfiguration();
- conf.setLocale = new Locale("es") // VERSION_CODES.JELLY_BEAN_MR1+
- String language = conf.getLocales().get(0).toString() // VERSION_CODES.N+
- Configuration config = context.getResources().getConfiguration();
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- locale = getSystemLocale(config);
- } else {
- locale = getSystemLocaleLegacy(config);
- }
- Locale locale = new Locale("es");
- Locale.setDefault(locale);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- setSystemLocale(config, locale);
- } else {
- setSystemLocaleLegacy(config, locale);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement