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.

enter image description here

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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -