[android-developers] How to implement this with location.distanceTo()?
Hi,
I trying to do this but doesn't seems to get it right.
I have runtime error - "NumericFormatError", is it because "1.35678"
is not Long but Float.
Then .setLatitute(Long) is long... how to implement this correctly?
// extract value from XML (so it's string value)
String Lat = pullParser.getAttributeValue(null, "lat");
String Lon = pullParser.getAttributeValue(null, "lon");
// converting this string value to long to call the distanceTo()
function
long seedLat = Long.parseLong(String.valueOf(Lat));
long seedLon = Long.parseLong(String.valueOf(Lon));
m.setLatitude(seedLat);
m.setLongitude(seedLon);
float distanceInMeters = location.distanceTo(m);
Regards,
CJ
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home