]> gitweb.fperrin.net Git - Dictionary.git/commitdiff
Try to work around ClassCastException issue.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Fri, 23 Jun 2017 21:29:37 +0000 (23:29 +0200)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Fri, 23 Jun 2017 21:29:37 +0000 (23:29 +0200)
src/com/hughes/android/dictionary/DictionaryManagerActivity.java

index 266ea87248ad4cf08ea38595eb1fd108334c62a2..0374794d82a84b48d65b70041d64341e53758384 100644 (file)
@@ -282,14 +282,23 @@ public class DictionaryManagerActivity extends ActionBarActivity {
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
-        // This must be first, otherwise the actiona bar doesn't get
+        // This must be first, otherwise the action bar doesn't get
         // styled properly.
-        setTheme(((DictionaryApplication) getApplication()).getSelectedTheme().themeId);
+        // Unfortunately on some (Samsung?) Android versions this
+        // results in a ClassCastException...
+        boolean themeSet = true;
+        try {
+            setTheme(((DictionaryApplication) getApplication()).getSelectedTheme().themeId);
+        } catch (ClassCastException e) {
+            themeSet = false;
+        }
 
         super.onCreate(savedInstanceState);
         Log.d(LOG, "onCreate:" + this);
 
         application = (DictionaryApplication) getApplication();
+        if (!themeSet)
+            setTheme(application.getSelectedTheme().themeId);
 
         blockAutoLaunch = false;