Recreate activity to update locale
This commit is contained in:
parent
52b29156f4
commit
41a85e5b49
1 changed files with 5 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
package net.osmand.plus.settings;
|
package net.osmand.plus.settings;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
@ -259,11 +260,12 @@ public class GlobalSettingsFragment extends BaseSettingsFragment {
|
||||||
settings.PREFERRED_LOCALE.addListener(new StateChangedListener<String>() {
|
settings.PREFERRED_LOCALE.addListener(new StateChangedListener<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void stateChanged(String change) {
|
public void stateChanged(String change) {
|
||||||
// restart application to update locale
|
// recreate activity to update locale
|
||||||
|
Activity activity = getActivity();
|
||||||
OsmandApplication app = getMyApplication();
|
OsmandApplication app = getMyApplication();
|
||||||
if (app != null) {
|
if (app != null && activity != null) {
|
||||||
app.checkPreferredLocale();
|
app.checkPreferredLocale();
|
||||||
app.restartApp(getContext());
|
activity.recreate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue