Reputation: 117
I am working in android mapping application that’s used Osmdroid mapping API until now I am being able to show the map and the user location in the map , but how I can show the accuracy circle around the marker and is that can be testing in the emulator only.{I need some examples or tutorials on that }
Upvotes: 0
Views: 2226
Reputation: 9044
Extend Overlay class and create a class and name it AccuracyIndicatorCircleOverlay (for example).
public class AccuracyIndicatorCircleOverlay extends Overlay {
}
Now override the draw method:
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
super.draw(canvas, mapView, shadow);
// Now you can use getAccuracy() method of android.location.Location
// to draw a circle based on your requirements.
}
Upvotes: 1
Reputation: 2889
I'm not familiar with osmdroid, but assuming you have access to the location data (specifically the accuracy) I would say just change out the image based on the accuracy. When you get a new location if the accuracy is different than previous then reset the image used for the user location. Seems to be the easiest solution assuming you get location updates.
If you are looking to add an overlay to a mapview here is a answer on SO where they used an overlay to create a radius according to accuracy.
Upvotes: 0