From f4cb71ab5347451cfab89d281ade78f6ebcf7e6c Mon Sep 17 00:00:00 2001 From: serso Date: Wed, 26 Jul 2017 10:32:00 +0200 Subject: [PATCH] Fix NPE in FloatingCalculatorService --- .../solovyev/android/calculator/CalculatorApplication.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java b/app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java index 4c16fb43..a01ca9bf 100644 --- a/app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java +++ b/app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java @@ -159,7 +159,6 @@ public class CalculatorApplication extends android.app.Application implements Sh } private void onPostCreate(@Nonnull final SharedPreferences prefs, @Nonnull Languages languages) { - App.init(this, prefs); languages.init(); prefs.registerOnSharedPreferenceChangeListener(this); @@ -198,6 +197,9 @@ public class CalculatorApplication extends android.app.Application implements Sh .setFormUriBasicAuthLogin("timbeenterumisideffecird") .setFormUriBasicAuthPassword("ECL65PO2TH5quIFNAK4hQ5Ng")); } + // initializing App before #onCreate as FloatingCalculatorService might be created in + // #onCreate + App.init(this, prefs); // then we should set default preferences Preferences.init(this, prefs);