From ac78e00afaf3b46a58ed29a5e5758b29fc3d2662 Mon Sep 17 00:00:00 2001 From: Aaron Culliney Date: Sat, 12 Dec 2015 13:29:50 -0800 Subject: [PATCH] Alter UI only on UI thread --- .../org/deadc0de/apple2ix/Apple2DisksMenu.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Android/app/src/main/java/org/deadc0de/apple2ix/Apple2DisksMenu.java b/Android/app/src/main/java/org/deadc0de/apple2ix/Apple2DisksMenu.java index 20908c97..c2734579 100644 --- a/Android/app/src/main/java/org/deadc0de/apple2ix/Apple2DisksMenu.java +++ b/Android/app/src/main/java/org/deadc0de/apple2ix/Apple2DisksMenu.java @@ -137,12 +137,17 @@ public class Apple2DisksMenu implements Apple2MenuView { public static void firstTime(Apple2Activity activity) { final ProgressBar bar = (ProgressBar) activity.findViewById(R.id.crash_progressBar); - try { - bar.setVisibility(View.VISIBLE); - bar.setIndeterminate(true); - } catch (NullPointerException npe) { - Log.v(TAG, "Whoa, avoided NPE in first time #1"); - } + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + try { + bar.setVisibility(View.VISIBLE); + bar.setIndeterminate(true); + } catch (NullPointerException npe) { + Log.v(TAG, "Whoa, avoided NPE in first time #1"); + } + } + }); getDataDir(activity);