In SearchListActivity, only start MyTracksLocationManager when needed.

This commit is contained in:
Jimmy Shih
2013-05-16 18:22:39 -07:00
parent 68180b2436
commit 82b6b63fc5
@@ -187,7 +187,6 @@ public class SearchListActivity extends AbstractSendToGoogleActivity
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, null);
searchEngine = new SearchEngine(myTracksProviderUtils);
searchRecentSuggestions = SearchEngineProvider.newHelper(this);
myTracksLocationManager = new MyTracksLocationManager(this, Looper.myLooper());
listView = (ListView) findViewById(R.id.search_list);
listView.setEmptyView(findViewById(R.id.search_list_empty));
@@ -263,12 +262,6 @@ public class SearchListActivity extends AbstractSendToGoogleActivity
trackRecordingServiceConnection.unbind();
}
@Override
protected void onDestroy() {
super.onDestroy();
myTracksLocationManager.close();
}
@Override
protected int getLayoutResId() {
return R.layout.search_list;
@@ -395,9 +388,11 @@ public class SearchListActivity extends AbstractSendToGoogleActivity
final String textQuery = intent.getStringExtra(SearchManager.QUERY);
setTitle(textQuery);
myTracksLocationManager = new MyTracksLocationManager(this, Looper.myLooper());
LocationListener locationListener = new LocationListener() {
@Override
public void onLocationChanged(final Location location) {
myTracksLocationManager.close();
new Thread() {
@Override
public void run() {