2

GooglePlayServices の最新リリース (12) には、スクリーン キャプチャ マップに関するドキュメント ( https://developers.google.com/maps/documentation/android/releases#august_2013 ) があります。ここに私が試したコードがありますが、まだ黒い画面が表示されます:

public void captureMapScreen() {
    SnapshotReadyCallback callback = new SnapshotReadyCallback() {
        Bitmap bitmap;

        @Override
        public void onSnapshotReady(Bitmap snapshot) {
            bitmap = snapshot;
            try {
                FileOutputStream out = new FileOutputStream("/mnt/sdcard/" + "MyMapScreen" +
                                                            System.currentTimeMillis() + ".png");

                // above "/mnt ..... png" => is a storage path (where image will be stored) + name of image you can
                // customize as per your Requirement

                bitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    };
    GoogleMap googleMap = getMap();
    googleMap.snapshot(callback);
}

ここに画像の説明を入力

4

0 に答える 0