diff options
Diffstat (limited to 'app/src/main/java/org/marcinzelent')
-rw-r--r-- | app/src/main/java/org/marcinzelent/liberavem/MainActivity.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/app/src/main/java/org/marcinzelent/liberavem/MainActivity.java b/app/src/main/java/org/marcinzelent/liberavem/MainActivity.java index 2b8cc38..dc261c5 100644 --- a/app/src/main/java/org/marcinzelent/liberavem/MainActivity.java +++ b/app/src/main/java/org/marcinzelent/liberavem/MainActivity.java @@ -30,17 +30,19 @@ public class MainActivity extends AppCompatActivity Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); - Fragment fragment = null; - Class fragmentClass = null; - fragmentClass = ObservationsFragment.class; - try { - fragment = (Fragment) fragmentClass.newInstance(); - } catch (Exception e) { - e.printStackTrace(); - } + if (savedInstanceState ==null) { + Fragment fragment = null; + Class fragmentClass = null; + fragmentClass = ObservationsFragment.class; + try { + fragment = (Fragment) fragmentClass.newInstance(); + } catch (Exception e) { + e.printStackTrace(); + } - FragmentManager fragmentManager = getSupportFragmentManager(); - fragmentManager.beginTransaction().replace(R.id.flContent, fragment).commit(); + FragmentManager fragmentManager = getSupportFragmentManager(); + fragmentManager.beginTransaction().replace(R.id.flContent, fragment).commit(); + } DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( |