您可以使用getMyLocation從MyLocationOverlay
。然後您需要將GeoPoint
轉換爲經度和長度各自的程度。
以下是Geo.java的參考文獻,其中包含一些可用於將GeoPoint
轉換爲相應的經度和緯度的功能。特別是要使用這兩個:
public static Location toLocation(GeoPoint point) {
Location result = new Location("");
result.setLatitude(toDegrees(point.getLatitudeE6()));
result.setLongitude(toDegrees(point.getLongitudeE6()));
return result;
}
而且
/**
* Convert microdegrees to degrees.
* @param degreesE6 Value in microdegrees.
* @return Value in degrees.
*/
public static double toDegrees(int degreesE6) {
return (double) degreesE6/E6;
}