オプションの変更後にロケールを強制しています:
public void forceLocale(Context ctx) {
Locale.setDefault(getCurrentLocale());
Configuration config = new Configuration();
config.locale = getCurrentLocale();
ctx.getResources().updateConfiguration(config, ctx.getResources().getDisplayMetrics());
}
現在のアクティビティを新しいロケールで表示したいのですが、表示されません。他の活動も同様です。
すべてのアクティビティの onResume() を無効にしようとしました:
protected void onResume() {
//if no custom locale, restore default
if (StaticClass.locale.getCurrentLocale() == null)
StaticClass.locale.restoreDefaultLocale();
//force curretnt locale
StaticClass.locale.forceLocale(this);
//reload the view
ViewGroup vg = (ViewGroup) findViewById(android.R.id.content);
vg.invalidate();
super.onResume();
}
無効。アプリは、メモリから消去されて再起動された後に翻訳されます