Skip to content Skip to sidebar Skip to footer

How To Get Snapshot From Google Map V2

I am wondering to know about how to get snapshot from SupportMapFragment. I have no idea. Please help. Thanks for your advance.

Solution 1:

To get a drawable you can implement this code:

SnapshotReadyCallbackcallback=newSnapshotReadyCallback() {
    @OverridepublicvoidonSnapshotReady(Bitmap snapshot) {
        mapSnapshot = snapshot;
    }
};

googleMap.snapshot(callback);

Drawablescreenshot=newBitmapDrawable(getResources(),mapSnapshot);

If you directly want to save the snapshot on the SD, you can follow this answer: Capture screen shot of GoogleMap Android API V2

Solution 2:

The latest update of Google Play Services library brings us ability to make snapshots via GoogleMap's snapshot() method.

Solution 3:

You can try to take a screen shot of the fragment View:

Viewview= findViewById(R.id.fragmentId);
 view.setDrawingCacheEnabled(true);
 Bitmapbitmap= view.getDrawingCache();
 BitmapDrawablebitmapDrawable=newBitmapDrawable(bitmap);

I haven't tested it.

Post a Comment for "How To Get Snapshot From Google Map V2"