2012-01-20 2 views
0

지도에서 특정 위치의 스냅 샷을 인 텐트 또는지도 뷰를 통해 만들고 싶습니다. 아무도 도와 줄 수 없습니다. 스냅 샷이 표시되지 않습니다.스냅 샷지도에서 android

답변

2

시도해보십시오. this 게시가 도움이 될 것입니다. 드로잉 캐시를 활성화하고 해당 캐시를 사용하도록합니다. 일반적으로 모든보기에서 작동합니다. 링크

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

감사합니다 dudeeeeee에서

코드 aswell MapView 작업을해야 ..... 내가 도움이 될 수 다행의 작업 ......... –

+0

@SreeDev을 awsme. :) – st0le