title: Capture screen shot of GoogleMap Android API V2
body: <p><strong>Final Update</strong></p>
  
  <p>The feature request has been fulfilled by Google.  Please see <a href="https://stackoverflow.com/a/18093295/1103584">this answer below.</a></p>
  
  <p><strong>Original Question</strong></p>
  
  <p>Using the old version of the Google Maps Android API, I was able to capture a screenshot of the google map to share via social media.  I used the following code to capture the screenshot and save the image to a file and it worked great:</p>
  
  <pre><code>public String captureScreen()
  {
      String storageState = Environment.getExternalStorageState();
      Log.d("StorageState", "Storage state is: " + storageState);
  
      // image naming and path  to include sd card  appending name you choose for file
      String mPath = this.getFilesDir().getAbsolutePath();
  
      // create bitmap screen capture
      Bitmap bitmap;
      View v1 = this.mapView.getRootView();
      v1.setDrawingCacheEnabled(true);
      bitmap = Bitmap.createBitmap(v1.getDrawingCache());
      v1.setDrawingCacheEnabled(false);
  
      OutputStream fout = null;
  
      String filePath = System.currentTimeMillis() + ".jpeg";
  
      try 
      {
          fout = openFileOutput(filePath,
                  MODE_WORLD_READABLE);
  
          // Write the string to the file
          bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fout);
          fout.flush();
          fout.close();
      } 
      catch (FileNotFoundException e) 
      {
          // TODO Auto-generated catch block
          Log.d("ImageCapture", "FileNotFoundException");
          Log.d("ImageCapture", e.getMessage());
          filePath = "";
      } 
      catch (IOException e) 
      {
          // TODO Auto-generated catch block
          Log.d("ImageCapture", "IOException");
          Log.d("ImageCapture", e.getMessage());
          filePath = "";
      }
  
      return filePath;
  }
  </code></pre>
  
  <p>However, the new GoogleMap object used by V2 of the api does not have a "getRootView()" method like MapView does. </p>
  
  <p>I tried to do this:</p>
  
  <pre><code>    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
              .findFragmentById(R.id.basicMap);
  
      View v1 = mapFragment.getView();
  </code></pre>
  
  <p>But the screenshot that I get does not have any map content and looks like this:
  <img src="https://i.stack.imgur.com/kUwDy.png" alt="Blank Map Screenshot"></p>
  
  <p>Has anyone figured out how to take a screenshot of the new Google Maps Android API V2?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I also tried to get the rootView this way:</p>
  
  <pre><code>View v1 = getWindow().getDecorView().getRootView();
  </code></pre>
  
  <p>This results in a screenshot that includes the action bar at the top of the screen, but the map is still blank like the screenshot I attached.</p>
  
  <p><strong>Update</strong></p>
  
  <p>A feature request has been submitted to Google.  Please go star the feature request if this is something you want google to add in the future:  <a href="http://code.google.com/p/gmaps-api-issues/issues/detail?id=4898" rel="noreferrer">Add screenshot ability to Google Maps API V2</a></p>