simra

MapView laggy, unresponsive after calling getMapDrawingCache

Discussion created by simra on Aug 16, 2012
Latest reply on Oct 3, 2013 by chirrup
Hi!

I have to report, that the bug discussed here http://forums.arcgis.com/threads/46792-mapview.getMapDrawingCache%28%29-returns-null is only partly fixed for me.
As said in that thread:
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


If you get the drawingcache from your whole mapview like this
map.getDrawingMapCache(0f, 0f,mMapView.getWidth(), mMapView.getHeight()));

it becomes really unresponsive and simply unusable. If the area is smaller like for example 200x200 there is no noticeable drop in responsiveness.
And sometimes I still need to call the method more then one time (but 2 times max).
I have tested this with SDK v1.1, v1.1.1 and v2.0 on a Galaxy Tab 10.1n, Galaxy S 2.3.6 and  a Galaxy Nexus with 4.1.1 with our ArcGIS Server 10.03.
Unfortunately I can not provide any logs, because there are none for this bug.

Outcomes