2013-04-07 139 views
0

我試圖在設備屏幕上僅顯示Google地圖,僅從min緯度/經度顯示到max Latitude/Longitude。我所做的是獲取最大和最小的經度和緯度和顯示爲以min爲單位顯示Google地圖緯度/經度爲max緯度/經度

map.animateTo(new GeoPoint((int)((maxLatitude + minLatitude)/2),(int)((maxLongitude + minLongitude)/2))); 

但它不起作用。此行對於「Google地圖類型的方法animateTo(GeoPoint)未定義」有編譯錯誤。哪裏不對?

+0

我正在使用Google Maps Android API v2。謝謝 – Bryanyan 2013-04-07 06:15:12

+0

GeoPoint來自API v1 – 2013-04-07 06:52:00

回答

0

我使用這種方法,它的工作原理。

Cursor cursor = dbHelp.fetchAllLatLongInTheList(); 
    LatLngBounds.Builder bld = new LatLngBounds.Builder(); 
    for(cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) 
    { 
     latitude = latitudelongitudeConverter(cursor.getString(3)); 
     longitude = latitudelongitudeConverter(cursor.getString(4)); 
     LatLng ll = new LatLng(latitude, longitude); 
     bld.include(ll); 
    }