diff --git a/app/src/main/java/org/secuso/privacyfriendlyactivitytracker/activities/TrainingOverviewActivity.java b/app/src/main/java/org/secuso/privacyfriendlyactivitytracker/activities/TrainingOverviewActivity.java index b4180be..901c436 100644 --- a/app/src/main/java/org/secuso/privacyfriendlyactivitytracker/activities/TrainingOverviewActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlyactivitytracker/activities/TrainingOverviewActivity.java @@ -74,11 +74,7 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_training_overview); - if(TrainingPersistenceHelper.getActiveItem(this) != null){ - // show current training session if there is one. - Log.w(LOG_CLASS, "Found active training session"); - startTrainingActivity(); - } + checkForActiveTrainingSession(); mEmptyView = findViewById(R.id.empty_view); @@ -119,10 +115,19 @@ public void onClick(View v) { @Override public void onResume() { super.onResume(); + checkForActiveTrainingSession(); // Force refresh of trainings. showTrainings(); } + private void checkForActiveTrainingSession() { + if (TrainingPersistenceHelper.getActiveItem(this) != null) { + // show current training session if there is one. + Log.w(LOG_CLASS, "Found active training session"); + startTrainingActivity(); + } + } + protected void startTrainingActivity(){ Intent intent = new Intent(this, TrainingActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);