Properly handle transient states

This commit is contained in:
M66B
2018-10-17 08:36:25 +00:00
parent f336306606
commit 52b23befe6
2 changed files with 54 additions and 37 deletions

View File

@@ -118,6 +118,8 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
this.stored = null;
owner.getLifecycle().addObserver(this);
onInit(args);
// Run in background thread
executor.submit(new Runnable() {
@Override
@@ -162,6 +164,9 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
}
}
protected void onInit(Bundle args) {
}
protected T onLoad(Context context, Bundle args) throws Throwable {
// Be careful not to access members in outer scopes
return null;