Permalink
Browse files

minor reorganizing

  • Loading branch information...
1 parent df31914 commit c94efb0f0a7b4c1b60b75b443f8616ba844999e7 @commonsguy committed Dec 26, 2012
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="app_name">MapsV2 Popups</string>
+ <string name="app_name">MapsV2 Location</string>
<string name="legal">Legal Notices</string>
<string name="no_maps">Google Maps V2 not available!</string>
<string name="normal">Normal</string>
@@ -63,9 +63,6 @@ protected void onCreate(Bundle savedInstanceState) {
map=mapFrag.getMap();
- locMgr=(LocationManager)getSystemService(LOCATION_SERVICE);
- crit.setAccuracy(Criteria.ACCURACY_FINE);
-
if (savedInstanceState == null) {
CameraUpdate center=
CameraUpdateFactory.newLatLng(new LatLng(40.76793169992044,
@@ -88,24 +85,28 @@ protected void onCreate(Bundle savedInstanceState) {
map.setInfoWindowAdapter(new PopupAdapter(getLayoutInflater()));
map.setOnInfoWindowClickListener(this);
+
+ locMgr=(LocationManager)getSystemService(LOCATION_SERVICE);
+ crit.setAccuracy(Criteria.ACCURACY_FINE);
+
map.setMyLocationEnabled(true);
map.getUiSettings().setMyLocationButtonEnabled(false);
}
}
-
+
@Override
public void onResume() {
super.onResume();
-
+
locMgr.requestLocationUpdates(0L, 0.0f, crit, this, null);
map.setLocationSource(this);
}
-
+
@Override
public void onPause() {
map.setLocationSource(null);
locMgr.removeUpdates(this);
-
+
super.onPause();
}
@@ -119,15 +120,15 @@ public boolean onNavigationItemSelected(int itemPosition, long itemId) {
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
-
+
savedInstanceState.putInt(STATE_NAV,
getSupportActionBar().getSelectedNavigationIndex());
}
-
+
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
-
+
getSupportActionBar().setSelectedNavigationItem(savedInstanceState.getInt(STATE_NAV));
}

0 comments on commit c94efb0

Please sign in to comment.