Select to view content in your preferred language

How to save screenshot of MapView in android application

4148
3
11-02-2015 07:47 AM
sujeetyadav
Deactivated User

In android application when i take screenshot of the screen the mapview but it is showing blank. But when i draw something on mapview screen using custom control then the screen shows like the above screenshot.

0 Kudos
3 Replies
WillCrick
Deactivated User

Hi,

This might be device dependent (i assume this screenshot is from a device, or is it from the emulator?). Can you confirm the device, os version and sdk version you are using please?

Are you using the devices screenshot implementation or writing this yourself in code? if you are writing your own code be aware that the mapview is implemented as a GLSurfaceView, see this stackoverflow post for good information on implementing this:

surfaceview - Android Take Screenshot of Surface View Shows Black Screen - Stack Overflow

I hope that helps

Will

sujeetyadav
Deactivated User

Device : Samsung Note 2 and Motorola e

OS     :     4.4.2 kitkat

Android SDK     :     19

For implementing the screenshot functionality i have implemented my own code.

Please suggest me the code for taking screenshot of mapview in android.

thanks

sujeet

0 Kudos
WillCrick
Deactivated User

Looking at this a little more i think there may be a solution. The stackoverflow post above would only work if you could get hold of the OpenGL SurfaceView itself, which we dont expose.

However, we do provide a method to get the current mapviews image which you can combine with the top level views image returned from the normal view.getDrawingCache method which you have posted above (this is actually what you would have to do if you did get an image from the SurfaceView anyway).

Assuming you are using our 10.2.7 release (not the quartz beta) you can do this with the MapView.getDrawingMapCache() method, here is the doc:

https://developersdev.arcgis.com/android/api-reference/reference/com/esri/android/map/MapView.html#g..., float, int, int)

w.