johnsonjp34
johnsonjp34

Reputation: 3299

Android maps api v2 Circles

Not sure what is going on here, but I want it to make an additional circle every second as the device moves. All it does is make 1 circle. I want the circles to highlight the route I have taken. Recommendations? Thanks

LocationManager locationmanager = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria cr = new Criteria();
String provider = locationmanager.getBestProvider(cr, true);
Location location = locationmanager.getLastKnownLocation(provider);

locationmanager.requestLocationUpdates(provider, 1000, 0, (LocationListener) this);




CircleOptions circleOptions = new CircleOptions()
.center(new LatLng(location.getLatitude(), location.getLongitude()));
circleOptions.radius(3.048); // In meters


mMap.addCircle(circleOptions);

Upvotes: 0

Views: 1930

Answers (1)

MaciejGórski
MaciejGórski

Reputation: 22232

Put:

CircleOptions circleOptions = new CircleOptions()
        .center(new LatLng(location.getLatitude(), location.getLongitude()));
circleOptions.radius(3.048); // In meters

mMap.addCircle(circleOptions);

inside onLocationChanged(Location location) callback.

Upvotes: 3

Related Questions