0

I have this code in layout:

<FrameLayout>    
        <fragment
            ...
            android:name="com.google.android.gms.maps.SupportMapFragment">
        </fragment>    
</FrameLayout>

But when i try use drawing cache, screenshot have only zoom bar (with + and - buttons) and text "Google" in left corner. I use next code for getting image:

View view = findViewById(R.id.frame);
view.setWillNotCacheDrawing(false);
view.destroyDrawingCache();
view.buildDrawingCache();
view.setDrawingCacheEnabled(true);
routeScreen = Bitmap.createBitmap(view.getDrawingCache());
view.setDrawingCacheEnabled(false);
  • Why are you doing this? i mean google map v2 directly provide `SnapshotReadyCallback` for the snap shot – M D Mar 10 '14 at 04:34

1 Answers1

1

The reason for this is because the map is drawn using OpenGL and the pixel data is stored in the GPU.

Have a look at Google Map's GoogleMap.snapshot() method in order to capture a screenshot of the map.

Tanner Perrien
  • 3,133
  • 1
  • 28
  • 35