1

I am using Google maps api v2 in android. I have created xml parser for the bus stop. Bus stops are displayed using markers. I need to find the user's current location and find the nearest location (bus stop), best automatically (for example in a radius of 0.5 kilometer).

I tried to find a tutorial, but unfortunately I failed it. Thank you for your help.

user3468921
  • 561
  • 2
  • 8
  • 26

1 Answers1

1

There is the distanceTo() method of Location class that gets the distance between 2 locations, in a straight line. You can find an example on how to use this here: How to get straight distance between two location in android?

But, if you don't want the straight line distance, rather the Travel distance, I'd recommend you take a look at this question and answer: Get the distance between two locations in android?

Community
  • 1
  • 1
ThomQ
  • 595
  • 2
  • 11
  • 32