Android的谷歌地图V2 - 添加对象标记 [英] Android Google Maps v2 - Add object to marker

查看:112
本文介绍了Android的谷歌地图V2 - 添加对象标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何可以将对象添加到标记新的谷歌地图Android的API V2 吗? 因此,如果我们的信息窗口,我们可以做的对象东西点击?

How can we add an object to a marker in the new Google Maps Android API v2? So if we click on the InfoWindow, we can do something with the object?

public void addSpotOnMap(Spot spot) {
    getMap().addMarker(new MarkerOptions()
            .position(new LatLng(spot.getParseGeoPoint().getLatitude(), spot.getParseGeoPoint().getLongitude()))
            .title(spot.getName())
            .snippet(spot.getCategory())
            .draggable(false));

}

此设置位置,标题和片段的对象。但是,我希望能够去这个特定的点对象另一个活动,如果我点击信息窗口

This sets the location, title and snippet for the object. But I want to be able to go to another activity about this specific Spot-object if I click on the InfoWindow

推荐答案

不能确定这是否是正确的答案,但看看本博文我提出这个问题:

Not really sure if this is the correct answer, but take a look at this blogpost I made about this problem:

由于标记最后,这是这可以很容易地通过与<$ C $连接的数据来解决C>标记在地图,例如的HashMap&LT;标记,YourDataClass&GT; 的HashMap&LT;标记,字符串&GT;

Since Marker is final, it's this can easily be solved by linking the data with the Marker in a Map, for example HashMap<Marker, YourDataClass> or HashMap<Marker, String>

下面是一个教程,解释了所有: <一href="http://bon-app-etit.blogspot.be/2012/12/add-informationobject-to-marker-in.html">http://bon-app-etit.blogspot.be/2012/12/add-informationobject-to-marker-in.html

Here's a tutorial that explains all: http://bon-app-etit.blogspot.be/2012/12/add-informationobject-to-marker-in.html

这篇关于Android的谷歌地图V2 - 添加对象标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆