1
0
Fork 0
mirror of https://github.com/MatomoCamp/matomocamp-companion-android.git synced 2024-09-19 16:13:46 +02:00

Fix: properly reuse the startup fragment in MainActivity after is has

been detached by setting its tag.
This commit is contained in:
Christophe Beyls 2014-03-31 03:43:11 +02:00
parent e1e3db0ae4
commit 831539359d

View file

@ -211,8 +211,9 @@ public class MainActivity extends ActionBarActivity implements ListView.OnItemCl
// Restore current section
if (savedInstanceState == null) {
currentSection = Section.TRACKS;
Fragment f = Fragment.instantiate(this, currentSection.getFragmentClassName());
getSupportFragmentManager().beginTransaction().add(R.id.content, f).commit();
String fragmentClassName = currentSection.getFragmentClassName();
Fragment f = Fragment.instantiate(this, fragmentClassName);
getSupportFragmentManager().beginTransaction().add(R.id.content, f, fragmentClassName).commit();
} else {
currentSection = Section.values()[savedInstanceState.getInt(STATE_CURRENT_SECTION)];
}