From 29a0130122c0a33e33b12cfff5bc89e18168b738 Mon Sep 17 00:00:00 2001 From: gitknilch Date: Tue, 26 Feb 2013 10:48:36 +0100 Subject: [PATCH 1/1] try to set options on startup --- src/de/cwde/shisensho/ShisenSho.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/de/cwde/shisensho/ShisenSho.java b/src/de/cwde/shisensho/ShisenSho.java index 654e4e0..00f959e 100644 --- a/src/de/cwde/shisensho/ShisenSho.java +++ b/src/de/cwde/shisensho/ShisenSho.java @@ -12,7 +12,7 @@ public class ShisenSho extends Application { public Board board; public int[] boardSize=new int[2]; - public int difficulty=1; // 1=Hard, 2=Easy + public int difficulty=1; // 1=Easy, 2=Hard public int size=3; // 1=Small, 2=Medium, 3=Big public boolean gravity=true; public boolean timeCounter=true; @@ -68,12 +68,13 @@ public class ShisenSho extends Application { } /** Called when the activity is first created. */ - @Override - public void onCreate() { - super.onCreate(); - PreferenceManager.setDefaultValues(this, R.xml.preferences, false); - } - + @Override + public void onCreate() { + super.onCreate(); + PreferenceManager.setDefaultValues(this, R.xml.preferences, false); + setOptions(); + } + public void setOptions() { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); @@ -104,7 +105,7 @@ public class ShisenSho extends Application { view.onTimeCounterActivate(); } - if (needsReset) { + if (needsReset && (view != null)) { view.reset(); } } -- 2.39.5