From 28175c6dc197d3645780a636dbc66877e6eb8b3b Mon Sep 17 00:00:00 2001 From: Mathis Dirksen-Thedens Date: Tue, 4 Oct 2022 14:02:54 +0200 Subject: [PATCH] fix crash when activity is created and there is a saved instance state --- .../org/zephyrsoft/trackworktime/OptionsActivity.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/zephyrsoft/trackworktime/OptionsActivity.java b/app/src/main/java/org/zephyrsoft/trackworktime/OptionsActivity.java index 04712c75..d569db7e 100644 --- a/app/src/main/java/org/zephyrsoft/trackworktime/OptionsActivity.java +++ b/app/src/main/java/org/zephyrsoft/trackworktime/OptionsActivity.java @@ -61,10 +61,12 @@ public class OptionsActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getSupportFragmentManager() - .beginTransaction() - .replace(android.R.id.content, new SettingsFragment()) - .commit(); + if (savedInstanceState == null) { + getSupportFragmentManager() + .beginTransaction() + .replace(android.R.id.content, new SettingsFragment()) + .commit(); + } ActionBar actionBar = getSupportActionBar(); if (actionBar != null) {