dulal_026
dulal_026

Reputation: 579

Distance of two geo point android

I am new android application developer. I have create a mapview application where i need to calculate the distance of two geo point.How can i do that.

Upvotes: 1

Views: 2156

Answers (1)

Femi
Femi

Reputation: 64700

Use the Location.distanceBetween method:

GeoPoint prev, current;
float[] results = new float[3];
Location.distanceBetween(prev.getLatitudeE6()/1E6, prev.getLongitudeE6()/1E6, current.getLatitudeE6()/1E6, current.getLongitudeE6()/1E6, results);

Upvotes: 4

Related Questions