diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-04-18 18:34:24 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-04-18 18:34:24 -0700 |
commit | b821a78dbf0db79426a540ea119ef3b29a1c2865 (patch) | |
tree | 5b95d0675ac470543ce88847ef05ad7c84374e33 /subsonic-android/src | |
parent | f875b73b57da0156714cde8a2a086821a803daef (diff) | |
download | dsub-b821a78dbf0db79426a540ea119ef3b29a1c2865.tar.gz dsub-b821a78dbf0db79426a540ea119ef3b29a1c2865.tar.bz2 dsub-b821a78dbf0db79426a540ea119ef3b29a1c2865.zip |
Fix redefining tabs when reopening activity
Diffstat (limited to 'subsonic-android/src')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java index 0240d5a3..fc283310 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java @@ -48,14 +48,16 @@ public class MainActivity extends SubsonicActivity { trackView = (TextView) bottomBar.findViewById(R.id.track_name);
artistView = (TextView) bottomBar.findViewById(R.id.artist_name);
- viewPager = (ViewPager) findViewById(R.id.pager);
- pagerAdapter = new TabPagerAdapter(this, viewPager);
- viewPager.setAdapter(pagerAdapter);
- viewPager.setOnPageChangeListener(pagerAdapter);
+ if (savedInstanceState == null) {
+ viewPager = (ViewPager) findViewById(R.id.pager);
+ pagerAdapter = new TabPagerAdapter(this, viewPager);
+ viewPager.setAdapter(pagerAdapter);
+ viewPager.setOnPageChangeListener(pagerAdapter);
- addTab("Home", MainFragment.class, null);
- addTab("Library", SelectArtistFragment.class, null);
- addTab("Playlists", SelectPlaylistFragment.class, null);
+ addTab("Home", MainFragment.class, null);
+ addTab("Library", SelectArtistFragment.class, null);
+ addTab("Playlists", SelectPlaylistFragment.class, null);
+ }
}
@Override
|