我想通过调用intent或mapview从地图创建特定位置的快照。任何人都可以帮助我。我没有得到快照。
答案 0 :(得分:2)
试试this帖子,我相信这应该会有所帮助。它涉及启用绘图缓存并强制它使用该缓存。通常适用于所有视图。应该在MapView
上工作
链接中的代码
private Bitmap getMapImage() {
/* Position map for output */
MapController mc = mapView.getController();
mc.setCenter(SOME_POINT);
mc.setZoom(16);
/* Capture drawing cache as bitmap */
mapView.setDrawingCacheEnabled(true);
Bitmap bmp = Bitmap.createBitmap(mapView.getDrawingCache());
mapView.setDrawingCacheEnabled(false);
return bmp;
}
private void saveMapImage() {
String filename = "foo.png";
File f = new File(getExternalFilesDir(null), filename);
FileOutputStream out = new FileOutputStream(f);
Bitmap bmp = getMapImage();
bmp.compress(Bitmap.CompressFormat.PNG, 100, out);
out.close();
}