2

プロジェクトに問題があります。データベース mySql の緯度と経度のデータを使用して、Google マップに複数のマーカーを表示する方法がわかりません。

配列リストを使用したコードは次のとおりです。

private class SitesOverlay extends ItemizedOverlay<OverlayItem> {
    private List<OverlayItem> items=new ArrayList<OverlayItem>();

    public SitesOverlay(Drawable marker) {
      super(marker);

      boundCenterBottom(marker);


      //i want change this, calling the data from mysql automatically
      items.add(new OverlayItem(getPoint(40.748963847316034,
                                          -73.96807193756104),
                                "UN", "United Nations"));
      items.add(new OverlayItem(getPoint(40.76866299974387,
                                          -73.98268461227417),
                                "Lincoln Center",
                                "Home of Jazz at Lincoln Center"));
      items.add(new OverlayItem(getPoint(40.765136435316755,
                                          -73.97989511489868),
                                "Carnegie Hall",
              "Where you go with practice, practice, practice"));
      items.add(new OverlayItem(getPoint(40.70686417491799,
                                          -74.01572942733765),
                                "The Downtown Club",
                        "Original home of the Heisman Trophy"));

      populate();
    }
4

2 に答える 2

0

属性を取り戻すためにPositionsとしてクラスを作成できると思います

Positionのクラスの場合、メソッドを呼び出して、キーワードを使用して位置を検索し、geo-locationsを返す関数を実装して、geoロケーションポイントを取得します。

于 2012-11-27T08:55:04.280 に答える
0

私が気に入っているこのクラスを使用してください: https://github.com/jgilfelt/android-mapviewballoonsと例があります。

SimpleItemizedOverlay itemizedoverlay = new MyItemizedOverlay(drawable, this);
GeoPoint point = new GeoPoint((int)(37.878901f * 1e6),(int)(-4.779396 * 1e6));
OverlayItem overlayitem = new OverlayItem(point, "Hello, World!", "I'm in Spain!");
.
.
.
GeoPoint point = new GeoPoint((int)(37.878901f * 1e6),(int)(-4.779396 * 1e6));
OverlayItem overlayitem = new OverlayItem(point, "Hello, World!", "I'm in Spain!");

itemizedoverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedoverlay);
于 2012-11-27T09:21:37.450 に答える