Audioplayer didn't always restore its state correctly

This commit is contained in:
daniel oeh 2013-04-11 11:07:23 +02:00
parent 565ff19510
commit c11288fcdb
1 changed files with 7 additions and 0 deletions

View File

@ -52,6 +52,8 @@ public class AudioplayerActivity extends MediaplayerActivity {
private Fragment currentlyShownFragment;
private int currentlyShownPosition = -1;
/** Used if onResume was called without loadMediaInfo. */
private int savedPosition = -1;
private TextView txtvTitle;
private TextView txtvFeed;
@ -131,6 +133,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
}
editor.commit();
savedPosition = currentlyShownPosition;
}
@Override
@ -213,6 +216,10 @@ public class AudioplayerActivity extends MediaplayerActivity {
true);
startService(launchIntent);
}
if (savedPosition != -1) {
switchToFragment(savedPosition);
}
}
@Override