diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-02-23 12:05:26 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-02-23 12:05:26 -0800 |
commit | ce4684ad9618f063abf3eb4a42cb81361a17be1d (patch) | |
tree | 1af951046042bcd2b375068d93d11dab9d047a66 /src/github | |
parent | f8bcea898f55f62e935ae97d79240d9228862442 (diff) | |
download | dsub-ce4684ad9618f063abf3eb4a42cb81361a17be1d.tar.gz dsub-ce4684ad9618f063abf3eb4a42cb81361a17be1d.tar.bz2 dsub-ce4684ad9618f063abf3eb4a42cb81361a17be1d.zip |
Fix issue with handler not being initialized in some cases
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/util/BackgroundTask.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/util/BackgroundTask.java b/src/github/daneren2005/dsub/util/BackgroundTask.java index b9fe212f..fbeaea74 100644 --- a/src/github/daneren2005/dsub/util/BackgroundTask.java +++ b/src/github/daneren2005/dsub/util/BackgroundTask.java @@ -53,7 +53,7 @@ public abstract class BackgroundTask<T> implements ProgressListener { private static Handler handler = null; static { try { - handler = new Handler(); + handler = new Handler(Looper.getMainLooper()); } catch(Exception e) { // Not called from main thread } @@ -69,6 +69,13 @@ public abstract class BackgroundTask<T> implements ProgressListener { thread.start(); } } + if(handler == null) { + try { + handler = new Handler(Looper.getMainLooper()); + } catch(Exception e) { + // Not called from main thread + } + } } public static void stopThreads() { |