diff options
Diffstat (limited to 'src/org/thialfihar/android/apg/BaseActivity.java')
-rw-r--r-- | src/org/thialfihar/android/apg/BaseActivity.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/org/thialfihar/android/apg/BaseActivity.java b/src/org/thialfihar/android/apg/BaseActivity.java index 17fe3b0c8..4a0360b25 100644 --- a/src/org/thialfihar/android/apg/BaseActivity.java +++ b/src/org/thialfihar/android/apg/BaseActivity.java @@ -17,6 +17,7 @@ package org.thialfihar.android.apg; import java.io.File; +import java.util.Locale; import android.app.Activity; import android.app.AlertDialog; @@ -25,6 +26,7 @@ import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.res.Configuration; import android.os.Bundle; import android.os.Environment; import android.os.Handler; @@ -60,6 +62,7 @@ public class BaseActivity extends Activity super.onCreate(savedInstanceState); mPreferences = Preferences.getPreferences(this); + setLanguage(this, mPreferences.getLanguage()); Apg.initialize(this); @@ -378,4 +381,21 @@ public class BaseActivity extends Activity protected String getDeleteFile() { return mDeleteFile; } + + public static void setLanguage(Context context, String language) + { + Locale locale; + if (language == null || language.equals("")) + { + locale = Locale.getDefault(); + } + else + { + locale = new Locale(language); + } + Configuration config = new Configuration(); + config.locale = locale; + context.getResources().updateConfiguration(config, + context.getResources().getDisplayMetrics()); + } } |