【问题标题】:Snapshot from the map in androidandroid中地图的快照
【发布时间】:2012-01-20 08:35:20
【问题描述】:

我想通过调用意图或从地图视图从地图中制作特定位置的快照。谁能帮助我。我没有得到快照。

【问题讨论】:

    标签: android maps location snapshot


    【解决方案1】:

    试试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();  
        }  
    

    【讨论】:

    • @SreeDev,很高兴我能帮上忙。 :)
    猜你喜欢
    • 2016-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-18
    • 2022-10-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多