code添加标记使用Android的谷歌地图V2地图 [英] code to add markers to map using android google maps v2
问题描述
我有纬度和放大器;从database.how长值显示基于纬度和放标志物;使用Android的谷歌地图API v2.In原生Android谷歌地图长期价值,我们展示基于概念itemoverlay标记。在V2中,我不知道如何显示标记。
I have lat&long values from database.how to display markers based on lat &long values using android google map api v2.In original android google maps,we display markers based on concept itemoverlay. In v2,I dont know how to display markers.
dbAdapter.open();
Cursor points = dbAdapter.clustercall(Btmlft_latitude, toprgt_latitude,
Btmlft_longitude, toprgt_longitude, gridsize1);
int c = points.getCount();
Log.d("count of points", "" + c);
if (points != null) {
if (points.moveToFirst()) {
do {
int latitude = (int) (points.getFloat(points
.getColumnIndex("LATITUDE")) * 1E6);
int longitude = (int) (points.getFloat(points
.getColumnIndex("LONGITUDE")) * 1E6);
mapView.addMarker(new MarkerOptions().position(
new LatLng(latitude, longitude)).icon(
BitmapDescriptorFactory.defaultMarker()));
} while (points.moveToNext());
}
}
points.close();
dbAdapter.close();
这是我的codeI我得到的纬度和放大器;从数据库中长值,但如何添加基于纬度和放标志物;长值映射
That is mycode.I am getting lat&long values from database,but how to add markers based on lat &long values to map.
我读了谷歌Android地图API v2.In那些只给出标记的添加静态数据
I read the android google maps api v2.In that have only give statically added data of markers
推荐答案
您必须使用方法 GoogleMap.addMarker(MarkerOptions);
我在我的博客上的教程说明这一点:
<一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
You have to use the method GoogleMap.addMarker(MarkerOptions);
I've explained this in a tutorial on my blog:
http://bon-app-etit.blogspot.be/2012/12/add-informationobject-to-marker-in.html
在这个博客,你会发现关于新地图API更多帖子:
On this blog, you'll find some more posts concerning the new Maps API:
- 将拖把到你的/部分的位置
- 创建自定义的信息窗口
- 关联的数据或对象标记
这篇关于code添加标记使用Android的谷歌地图V2地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!