使用自定义名称保存Google地图快照

时间:2014-02-11 14:16:15

标签: android image google-maps filenames snapshot

我正在开发一款能够捕捉谷歌地图(V2)图像的Android应用程序。我要求用户为这些图片命名。用户应该能够在按下快照按钮后命名图片。我应该将编辑文本放入警告对话框,然后将编辑文本中的字符串作为图像名称吗?这是我用来捕获这些图像的代码:

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

        @Override
        public void onSnapshotReady(Bitmap snapshot) {
            bitmap = snapshot;
            try {
                FileOutputStream out = new FileOutputStream(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)+File.separator+"Rute"+File.separator
                    + "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();
            }
        }
    };

    map.snapshot(callback);
}

0 个答案:

没有答案