aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-02-23 12:05:26 -0800
committerScott Jackson <daneren2005@gmail.com>2014-02-23 12:05:26 -0800
commitce4684ad9618f063abf3eb4a42cb81361a17be1d (patch)
tree1af951046042bcd2b375068d93d11dab9d047a66 /src/github
parentf8bcea898f55f62e935ae97d79240d9228862442 (diff)
downloaddsub-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.java9
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() {