diff --git a/src/main/java/de/dennisguse/opentracks/TrackDeleteActivity.java b/src/main/java/de/dennisguse/opentracks/TrackDeleteActivity.java index 3ccbbd74a9..5ed156b236 100644 --- a/src/main/java/de/dennisguse/opentracks/TrackDeleteActivity.java +++ b/src/main/java/de/dennisguse/opentracks/TrackDeleteActivity.java @@ -64,12 +64,21 @@ public void onCreate(Bundle savedInstanceState) { 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 @@ protected void onStop() { deleteThread.interrupt(); } - @Override - protected void onDestroy() { - super.onDestroy(); - viewBinding = null; - } - @Override protected View getRootView() { viewBinding = TrackDeleteBinding.inflate(getLayoutInflater());