From 25adac1dcdb2d89c55efb800322fd0a28f02b579 Mon Sep 17 00:00:00 2001 From: serso Date: Mon, 23 Feb 2015 10:23:45 +0100 Subject: [PATCH] Fix for NPE in CalculatorApplication class --- .../android/calculator/CalculatorApplication.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java index f873a0de..3c21fd30 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java @@ -46,6 +46,7 @@ import org.solovyev.common.msg.MessageType; import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.TimeUnit; @ReportsCrashes(formKey = "", formUri = "https://serso.cloudant.com/acra-cpp/_design/acra-storage/_update/report", @@ -183,8 +184,13 @@ public class CalculatorApplication extends android.app.Application implements Sh Locator.getInstance().getLogger().debug(TAG, "Application started!"); Locator.getInstance().getNotifier().showDebugMessage(TAG, "Application started!"); - // we must update the widget when app starts - App.getBroadcaster().sendEditorStateChangedIntent(); + App.getUiThreadExecutor().execute(new Runnable() { + @Override + public void run() { + // we must update the widget when app starts + App.getBroadcaster().sendEditorStateChangedIntent(); + } + }, 100, TimeUnit.MILLISECONDS); } private void setTheme(@Nonnull SharedPreferences preferences) {