0

我是 android 应用程序的大佬,我对 GeoLocalisation 应用程序很感兴趣。所以,我开发了一个应用程序,它返回用户设备的当前位置(纬度/经度),我的问题是我想在那个位置获得一个标记。你可以在这个链接中找到我的源代码,所以请有人知道如何解决这个问题我会很高兴 http://hotfile.com/dl/134520763/75c0f91/current_location.rar.html

4

2 回答 2

1

类 HelloItemizedOverlay 扩展 ItemizedOverlay { private ArrayList mOverlays = new ArrayList(); 私有上下文 mContext;

    public HelloItemizedOverlay(Drawable defaultMarker, Context context) {
        super(boundCenterBottom(defaultMarker));
        mContext = context;
    }

    public void addOverlay(OverlayItem overlay) {
        mOverlays.add(overlay);
        populate();
    }

    @Override
    protected OverlayItem createItem(int i) {
        return mOverlays.get(i);
    }

    @Override
    public int size() {
        return mOverlays.size();
    }

    @Override
    protected boolean onTap(int index) {
        OverlayItem item = mOverlays.get(index);
        AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
        dialog.setTitle(item.getTitle());
        dialog.setMessage(item.getSnippet());
        dialog.show();
        return true;
    }
}



GeoPoint    geoPoint = new GeoPoint((int) (latitude * 1E6), (int) (longitude * 1E6));

        mapOverlays = mapView.getOverlays();
        Drawable drawable = this.getResources().getDrawable(R.drawable.pin);
        itemizedOverlay = new HelloItemizedOverlay(drawable, this);
overlayItem = new OverlayItem(geoPoint, "Starting Location", "any text");
                                    itemizedOverlay.addOverlay(overlayItem);
                        mapOverlays.add(itemizedOverlay);

            MapController mapController = mapView.getController();
            mapController.animateTo(geoPoint);
于 2011-11-08T18:14:39.063 回答
0

内联发布您的代码。您将需要使用 ItemizedOverLay 之类的东西。看这里

于 2011-11-08T18:15:08.863 回答