Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Restore stations lists objects after screen rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
bparmentier committed Oct 31, 2014
1 parent 032496c commit 50f365e
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ public void onClick(DialogInterface dialog, int which) {
dialog.show();
} else {
if (savedInstanceState != null) {
bikeNetwork = (BikeNetwork) savedInstanceState.getSerializable("bikeNetwork");
stations = (ArrayList<Station>) savedInstanceState.getSerializable("stations");
favStations = (ArrayList<Station>) savedInstanceState.getSerializable("favStations");
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
tabsPagerAdapter = new TabsPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(tabsPagerAdapter);
Expand All @@ -159,6 +162,14 @@ protected void onRestart() {
}
}

@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putSerializable("bikeNetwork", bikeNetwork);
outState.putSerializable("stations", stations);
outState.putSerializable("favStations", favStations);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
this.optionsMenu = menu;
Expand Down

0 comments on commit 50f365e

Please sign in to comment.