android - Check if marker is inside circle radius -
i'm trying know if given marker inside circle radius.
in javascript, can like:
google.maps.geometry.spherical.computedistancebetween(latlngcirclecenter, latlngpoint);
but in android, using maps-v2, i'm stucked.
after lot of research, found simple solution:
float[] distance = new float[2]; location.distancebetween( marker.getposition().latitude, marker.getposition().longitude, circle.getcenter().latitude, circle.getcenter().longitude, distance); if( distance[0] > circle.getradius() ){ toast.maketext(getbasecontext(), "outside", toast.length_long).show(); } else { toast.maketext(getbasecontext(), "inside", toast.length_long).show(); }
i'm testing , it's working. can test , give feedback here?
Comments
Post a Comment