2012-07-02 56 views
3

多個緯度長期使用地理我用下面的代碼使用地理默認的谷歌地圖在Android的

Uri uri = Uri.parse("geo:"+Global.detail_lat+","+Global.detail_long+"?q="+Global.detail_lat+","+Global.detail_long+""); 
Intent in = new Intent(Intent.ACTION_VIEW, uri); 
startActivity(in); 

它的做工精細,以顯示默認的谷歌地圖上的位置。現在我想知道,我可以使用地理位置在默認地圖上顯示多個位置(多個拉特,長)嗎?我可以傳遞數組還是其他任何東西?

感謝, 周杰倫帕特爾

回答

1

你可以做到這一點,你需要有其自帶的Android中顯示谷歌地圖標記多個SDK,你可以從這裏下載SDK。 SDK

在這裏你可以找到關於HOW TO SHOW MORE THAN ONE MARKS IN ANDROID GOOGLE MAP

完整的指南,在下面的類陣列已經通過了不同的位置

public void drawMalls(){ 
Drawable marker = getResources().getDrawable(R.drawable.malls); 
MallOverlay mallsPos = new MallOverlay(marker,mapView); 
    GeoPoint[] mallCoords = new GeoPoint[6]; 

    //Load Some Random Coordinates in Miami, FL 
    mallCoords[0] = new GeoPoint(29656582,-82411151);//The Oaks Mall 
    mallCoords[1] = new GeoPoint(29649831,-82376347);//Creekside mall 
    mallCoords[2] = new GeoPoint(29674146,-8238905);//Millhopper Shopping Center 
    mallCoords[3] = new GeoPoint(29675078,-82322617);//Northside Shopping Center 
    mallCoords[4] = new GeoPoint(29677017,-82339761);//Gainesville Mall 
    mallCoords[5] = new GeoPoint(29663835,-82325599);//Gainesville Shopping Center  

    List<Overlay> overlays = mapView.getOverlays(); 
OverlayItem overlayItem = new OverlayItem(mallCoords[0], "The Oaks Mall", "6419 W Newberry Rd, Gainesville, FL 32605"); 
mallsPos.addOverlay(overlayItem); 
overlayItem = new OverlayItem(mallCoords[1], "Creekside Mall", "3501 Southwest 2nd Avenue, Gainesville, FL"); 
mallsPos.addOverlay(overlayItem); 
overlayItem = new OverlayItem(mallCoords[2], "Millhopper Shopping Center", "NW 43rd St & NW 16th Blvd. Gainesville, FL"); 
mallsPos.addOverlay(overlayItem); 
overlayItem = new OverlayItem(mallCoords[3], "Northside Shopping Center", "Gainesville, FL"); 
mallsPos.addOverlay(overlayItem); 
overlayItem = new OverlayItem(mallCoords[4], "Gainesville Mall", "2624 Northwest 13th Street Gainesville, FL 32609-2834"); 
mallsPos.addOverlay(overlayItem); 
overlayItem = new OverlayItem(mallCoords[5], "Gainesville Shopping Center", "1344 N Main St Gainesville, Florida 32601"); 
mallsPos.addOverlay(overlayItem); 
overlays.add(mallsPos); 

mallsPos.setCurrentLocation(currentLocation); 

}

+1

嗨。感謝您的回覆。但我需要爲它創建mapview佈局。我想在默認的谷歌地圖做使用uri – Jai

+0

看到我的上面的代碼我沒有使用它的mapview。我正在使用geo uri在Google地圖上顯示位置。那麼是否可以使用uri geo顯示不同的位置? – Jai

+0

對不起,我剛纔工作谷歌地圖多個位置...... – Aamirkhan