The problem is that when the bitmap is the entire map there is a lag in generating the bitmap.
If the bitmap is a smaller area the lag is unnoticeable.
This a bug we are fixing.
The code posted earlier if executed twice works without a problem.
Try using the code below, if you single tap on the map twice you will see the bitmap.
map.setOnSingleTapListener(new OnSingleTapListener() {
/**
*
*/
private static final long serialVersionUID = 1L;
public void onSingleTap(float arg0, float arg1) {
Polygon polygon = map.getExtent();
Envelope env = new Envelope();
polygon.queryEnvelope(env);
Bitmap bitmap = map.getDrawingMapCache(arg0, arg1,
100, 100));
// Bitmap bitmap = map.getDrawingMapCache(0, 0,
// map.getWidth(), map.getHeight()));
Log.d(TAG, "width = " + map.getWidth() + " ht = "
+ map.getHeight());
ImageView img = new ImageView(HelloWorld.this);
img.setImageBitmap(bitmap);
map.addView(img);
}
});
Thanks
Archana
map.getDrawingMapCache(0f, 0f,mMapView.getWidth(), mMapView.getHeight()));
Simon,
I've tried setting it to false after generating the map image, and i've tried calling destroyDrawingCache() and getDrawingCache().recycle();. None of them seem to solve the problem.
-Andrew
Just an update. We logged a bug for this behavior. NIM084361: MapView gets unresponsive after calling the getDrawingMapCache() method. We will target a fix in the upcoming release.
Would you please comment on what you plan to do with the static image following the getDrawingMapCache() call? If we have a understanding of this we could test this method in the SDK accordingly.
-Doug C, ESRI Support Services, SDK Tech Lead
http://support.esri.com/