Use local looper

This commit is contained in:
M66B 2018-12-20 20:47:15 +01:00
parent d5b59bee51
commit 80c5969f82
1 changed files with 4 additions and 1 deletions

View File

@ -116,8 +116,11 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
this.paused = false;
this.args = null;
this.stored = null;
owner.getLifecycle().addObserver(this);
final Handler handler = new Handler();
// Run in background thread
executor.submit(new Runnable() {
@Override
@ -132,7 +135,7 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
}
// Run on main thread
new Handler(context.getMainLooper()).post(new Runnable() {
handler.post(new Runnable() {
@Override
public void run() {
deliver(args, result);