Question

I have map & i am trying to get the snapshot of Map on Button click.

/**
 * Called when the snapshot button is clicked.
 */
public void onScreenshot(View view) {
    takeSnapshot();
}

private void takeSnapshot() {

    System.out.println("Take SnapShot.......##################");
    if (map == null) {


        return;
    }

    final SnapshotReadyCallback callback = new SnapshotReadyCallback() {
        @Override
        public void onSnapshotReady(Bitmap snapshot) {
            // Callback is called from the main thread, so we can modify the ImageView safely.
            image.setImageBitmap(snapshot);
        }
    };

        map.setOnMapLoadedCallback(new OnMapLoadedCallback() {
            @Override
            public void onMapLoaded() {
                map.snapshot(callback);
            }
        });

}

I am getting Error on this line

final SnapshotReadyCallback callback = new SnapshotReadyCallback()

The below is my stacktrace.

enter image description here

Please help i am trying from last two days.

Was it helpful?

Solution

Check this answer.

It seems that maybe you have your google play services api outdated.

EDIT: i.n.e.f has solved it after by adding Google Play Services to Build Path

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top