在Android中生成GeoPoint时出现问题

pol*_*kyg 0 android location

我正在尝试创建GeoPoints,但我不能到目前为止.

double latitudeUpperLeft = -34.567645; 
double longitudeUpperLeft = -58.497734;
double latitudeBottomRight = -34.62558;
double longitudeBottomRight = -58.42495;

GeoPoint geoPointUpperLeft = calculateGeoPoint(latitudeUpperLeft, longitudeUpperLeft);
GeoPoint geoPointBottomRight = calculateGeoPoint(latitudeBottomRight, longitudeBottomRight);
Run Code Online (Sandbox Code Playgroud)

这是辅助方法:

public static GeoPoint calculateGeoPoint(double latitude, double longitude) {
    Double latE6 = latitude * 1E6;
    Double lngE6 = longitude * 1E6;
    return  new GeoPoint(latE6.intValue(), lngE6.intValue());
}
Run Code Online (Sandbox Code Playgroud)

我在返回helper方法时遇到InvocationTargetException,可能是什么错误?谢谢.吉列尔莫.

Sam*_*uel 5

你能告诉我这是否有效吗?

public static GeoPoint calculateGeoPoint(double latitude, double longitude) {
    return  new GeoPoint((int)(latitude * 1E6), (int)(longitude * 1E6));
}
Run Code Online (Sandbox Code Playgroud)