jagdishkumawat
jagdishkumawat

Reputation: 301

How to check if one location coordinates fall to another location coordinates radius in android

I have latitude and longitude of a current location. I want to check if target location (latitude and longitude) is close with 50 meter radius to the current location.

I am new to android.if anyone have solution about this.please reply.

Upvotes: 11

Views: 4159

Answers (1)

AlexWien
AlexWien

Reputation: 28727

use the built in distance calculation:

Location loc;
.....
float radius = 50.0;
float distance = loc.distanceTo(loc2);
if (distance < radius) then inside.

Upvotes: 17

Related Questions