Bugfix: crash deleting when activity restarts. Fixes
@@ -64,12 +64,21 @@ public class TrackDeleteActivity extends AbstractActivity {
runOnUiThread(TrackDeleteActivity.this::onAsyncTaskCompleted);
});
+ deleteThread.start();
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ viewBinding = null;
}
@Override
protected void onStart() {
super.onStart();
- deleteThread.start();
+ if (deleteThread.getState() == Thread.State.TERMINATED) {
+ onAsyncTaskCompleted();
+ }
}
@Override
@@ -78,12 +87,6 @@ public class TrackDeleteActivity extends AbstractActivity {
deleteThread.interrupt();
}
- @Override
- protected void onDestroy() {
- super.onDestroy();
- viewBinding = null;
- }
-
@Override
protected View getRootView() {
viewBinding = TrackDeleteBinding.inflate(getLayoutInflater());
