2

I am developing one Track Routes application for bikers. SO whatever route was drawn on map, I want that screen shot with that path drawn to use in share with Social Media.

But I am not getting screen shot of the map.

Anyone know how to take screen shot of the Google Map V2.

Chintan Rathod
  • 25,864
  • 13
  • 83
  • 93
Pratik Dasa
  • 7,439
  • 4
  • 30
  • 44
  • This looks like what you want: http://stackoverflow.com/questions/7762643/android-take-screen-shot-programatically – Shpongoloid Jul 31 '13 at 09:52
  • Ya code is fine but its not what I need is, I need Google map V2 things. Thanks for reply but its not what I need. – Pratik Dasa Jul 31 '13 at 11:14

1 Answers1

1

There is a method called getDrawingCache() provided by every view. You can try following code.

MapView map = (MapView) findViewById(R.id.map_view);
map.buildDrawingCache();
Bitmap bitmap = map.getDrawingCache();
map.destroyDrawingCache();

You have now bitmap. You can use it as you want.

Chintan Rathod
  • 25,864
  • 13
  • 83
  • 93
  • 1
    Yeah you are right but not for Google Map api V2. Because this api is using fragment to display the map not the view. So I am not getting the view of the map. Sorry but this will not work for map api v2. – Pratik Dasa Jul 31 '13 at 10:47
  • @pratik, But in MapFragment, aren't you getting any MapView inside? – Chintan Rathod Jul 31 '13 at 10:48
  • No I have tried a lot but unable to get it. Most of the sites are saying that its not possible in map api V2 because it is using OpenGL to display the map. – Pratik Dasa Jul 31 '13 at 10:50
  • @pratik, Okay. I haven't tried in map, but I got those method in MapViews. Let me try that and let you know. – Chintan Rathod Jul 31 '13 at 10:52