我正在嘗試創建GeoPoints,但目前爲止還沒有。在Android中生成GeoPoint時出現問題
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);
這是輔助方法:
public static GeoPoint calculateGeoPoint(double latitude, double longitude) {
Double latE6 = latitude * 1E6;
Double lngE6 = longitude * 1E6;
return new GeoPoint(latE6.intValue(), lngE6.intValue());
}
我的助手方法返回得到一個的InvocationTargetException,可能是錯了呢? 謝謝。吉列爾莫。
哈哈這種情況。你仍然可以選擇你的作爲和答案。並有我的一個小調整。你不必浪費兩個變量與拳擊和拆箱。或者至少讓他們**最後**。 – Samuel
沒錯,我也在使用你的),謝謝! – polonskyg