android - Changing default locale with the format of b+<language_code>? -


i want users able change language of app without changing language of phone. i'm able method found:

public static void changelanguage(context context) {     locale locale = new locale("in");     locale.setdefault(locale);      resources resources = context.getresources();     configuration config = resources.getconfiguration();      if (build.version.sdk_int >= build.version_codes.n) {         config.setlocale(locale);     } else {         config.locale = locale;     }      if (build.version.sdk_int >= build.version_codes.n_mr1) {         context.createconfigurationcontext(config);     } else {         resources.updateconfiguration(config, resources.getdisplaymetrics());     } } 

the new locale("in") going work if have values-in. i'm using values-b+id. i've tried new locale("b+id") , new locale("id") it's not working either.

note: translation working if change language of phone


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -