【发布时间】:2013-01-07 11:24:21
【问题描述】:
我有来自数据库的 lat&long 值。如何使用 android google map api v2 显示基于 lat&long 值的标记。在原始的 android google maps 中,我们基于概念 itemoverlay 显示标记。在 v2 中,我不知道如何显示标记。
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();
这是我的代码。我正在从数据库中获取lat&long 值,但是如何根据 lat&long 值添加标记到地图。
我阅读了仅提供静态添加的标记数据
的android google maps api v2.In【问题讨论】:
标签: android google-maps-android-api-2