我有来自数据库的 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,它只给出了静态添加的标记数据