Fix TrackDetailActivity to just finish instead of launching

the TrackListActivity during a error.
This commit is contained in:
Jimmy Shih
2013-02-06 16:06:23 -08:00
parent 760223029a
commit f8ecf409ca
@@ -183,9 +183,9 @@ public class TrackDetailActivity extends AbstractMyTracksActivity implements Del
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
myTracksProviderUtils = MyTracksProviderUtils.Factory.get(this);
handleIntent(getIntent()); handleIntent(getIntent());
myTracksProviderUtils = MyTracksProviderUtils.Factory.get(this);
sharedPreferences = getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE); sharedPreferences = getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
trackRecordingServiceConnection = new TrackRecordingServiceConnection( trackRecordingServiceConnection = new TrackRecordingServiceConnection(
@@ -486,26 +486,17 @@ public class TrackDetailActivity extends AbstractMyTracksActivity implements Del
if (markerId != -1L) { if (markerId != -1L) {
Waypoint waypoint = myTracksProviderUtils.getWaypoint(markerId); Waypoint waypoint = myTracksProviderUtils.getWaypoint(markerId);
if (waypoint == null) { if (waypoint == null) {
exit(); finish();
return; return;
} }
trackId = waypoint.getTrackId(); trackId = waypoint.getTrackId();
} }
if (trackId == -1L) { if (trackId == -1L) {
exit(); finish();
return; return;
} }
} }
/**
* Exists and returns to {@link TrackListActivity}.
*/
private void exit() {
Intent newIntent = IntentUtils.newIntent(this, TrackListActivity.class);
startActivity(newIntent);
finish();
}
/** /**
* Shows marker. * Shows marker.
*/ */