I am an android beginner and can't find the answer anywhere.
I want to show the markers on the map that are 25 km from the center of the map. I can't find the way to find the location of the center of the map, then show the markers that are 25km from it.
The geopoints are on Parse.com in the Cars.class, in the row "location". So far, event the code to show the markers doesn't work, it gets the results:
{"objectId": "[...]","location": {"__type":"GeoPoint","latitude": [...],"longitude": [...] },"createdAt":"[...]","updatedAt": "[...]"}
It crashes and gives me the error:
com.parse.ParseObject cannot be cast to com.company.test.Cars.
Thanks for the help!
ParseQuery<Cars> query = ParseQuery.getQuery("Cars");
query.selectKeys(Collections.singletonList("location"));
query.findInBackground(new FindCallback<Cars>(){
@Override
public void done(List<Cars> list, ParseException e) {
if (e != null) {
return;
}
ParseGeoPoint geoPoint;
for(int i =0;i<list.size();i++){
geoPoint = list.get(i).getParseGeoPoint("location");
mMap.addMarker(new MarkerOptions().position(new LatLng(geoPoint.getLatitude(), geoPoint.getLongitude())));