MapView occasionally freezes

Discussion created by knisleyj on Dec 5, 2013
Latest reply on Mar 5, 2014 by bojan.bukovicgdi-net-esridist
I've trying to diagnose an intermittent problem and I'm hoping that someone can help me out. I developed an app that is being used for offline data collection, and occasionally it freezes during panning or zooming. When I say freezes, I mean that the tiles from an ArcGISLocalTiledLayer partially load and then the MapView becomes unresponsive and ceases to load any more tiles. I've witnessed this across a variety of different tpk files used for the tiled layer.

Looking in LogCat, there are no errors being logged and gestures still trigger ArcGIS.Gesture entries. I wrote some code to zoom the map to different points every few seconds, and even when the map view freezes I still see my LogCat entries zooming to different locations on the MapView... getCenter() correctly returns the new zoom point and getScale() returns the new scale, even though the MapView tiles don't change. The rest of the UI normally remains responsive (for example, tapping a button will still open a DialogFragment) although sometimes tapping a button while the MapView is frozen will result in a dialog stating that the application has stopped responding.

I can only assume that an error is being thrown in a background thread as it is processing the bitmaps for the tiles, but it seems completely random. For example, after randomly generating 100 points and scales on the first run I put those into an array so that now the first 100 pan/zoom iterations are always the same so that I can have some consistency between tests. Sometimes it freezes after a dozen or so iterations, other times it can go well into the hundreds before finally freezing, leading me to believe it's not a problem with the tpk file itself because the error never consistently occurs in any one place.

Any ideas how I can go about debugging this, or at the very least programmatically detect when the MapView becoming unresponsive so that I can reload it without users having to close out and reload the application?