Yes you can change device locale for any android version make sure that your app is system app.Heres the code to help you out.Please rate my answer if you like it.
//getting the languages that are shown same as in our device settings
String[] systemLocaleIetfLanguageTags = getAssets().getLocales();
Arrays.sort(systemLocaleIetfLanguageTags);
this.locale_data = new ArrayList();
for (String ietfLanguageTag : systemLocaleIetfLanguageTags)
{
if (ietfLanguageTag != null && ietfLanguageTag.length() == 5)
{
this.locale_data.add(new Loc(ietfLanguageTag));
}
}
adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, android.R.id.text1, locale_data);
// Assign adapter to ListView
lv.setAdapter(adapter);
lv.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3)
{
int itemPosition = position;
Loc loc = (Loc) ChangeLanguage.this.adapter.getItem(position);
Toast.makeText(ChangeLanguage.this, "language activated successfully !!", 0).show();
ChangeLanguage.change_setting(loc.getLocale());
}
});
}
//to change the locale
public static void change_setting(Locale loc)
{
try
{
Class<?> activityManagerNative = Class.forName("android.app.ActivityManagerNative");
Object am = activityManagerNative.getMethod("getDefault", new Class[0]).invoke(activityManagerNative, new Object[0]);
Object config = am.getClass().getMethod("getConfiguration", new Class[0]).invoke(am, new Object[0]);
config.getClass().getDeclaredField("locale").set(config, loc);
config.getClass().getDeclaredField("userSetLocale").setBoolean(config, true);
am.getClass().getMethod("updateConfiguration", new Class[] { Configuration.class }).invoke(am, new Object[] { config });
}
catch (Exception e)
{
e.printStackTrace();
}
}