【发布时间】:2017-12-02 11:04:34
【问题描述】:
目前,我正在开发一个应用程序,该应用程序使用 Google Maps API 在地图上绘制用户拍照的点。这些图像是从我创建的数据库中存储和检索的。当地图第一次启动时,我检索图片并绘制点。从数据库中获取 byte[] 后,我将其转换为位图,并将标记图标设置为 DescriptorFactory 中的位图。但是,编译器会抛出有关提供的图像必须是位图的错误。我有 99% 的把握。
private void plotMarkers(GoogleMap mMap) {
ImageHelper imageHelper = new ImageHelper(this, null, null, 1);
markers = imageHelper.selectAll();
if(markers.size() > 0)
{
int index = 0;
for (MyMarker myMarker : markers)
{
Bitmap bitmap = (imageHelper.getImage(index));
MarkerOptions markerOption = new MarkerOptions()
.position(new LatLng(myMarker.getLatitude(), myMarker.getLongitude()))
.icon(BitmapDescriptorFactory.fromBitmap(bitmap));
Marker currentMarker = mMap.addMarker(markerOption);
markersHashMap.put(currentMarker, myMarker);
index++;
}
}
}
【问题讨论】:
标签: android google-maps bitmap