Using Thinkgeo smaple code for android I modified the code so that the OSM are in the sample, and modified the corresponding file UseOpenStreetMapOverlay.cs file by adding the following to set up a tile cache:
FileBitmapTileCache bitmapTileCache = new FileBitmapTileCache();
var documents = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
var cachePath = System.IO.Path.Combine(documents, "CachedFiles");
if (!System.IO.Directory.Exists(cachePath))
{
System.IO.Directory.CreateDirectory(cachePath);
}
bitmapTileCache.CacheDirectory = cachePath;
bitmapTileCache.CacheId = "OSMCachedTiles";
bitmapTileCache.ImageFormat = TileImageFormat.Png;
osmOvelerlay.TileCache = bitmapTileCache;
This was added after the extents were set and prior to the overlay being added to the map. This does not generate the same exception that I am seeing in our application, but does cause an exception to be thrown while zooming in rapidly.
The exception in this case is
System.ObjectDisposedException: Cannot access a disposed object.
Object name: ‘ThinkGeo.MapSuite.Android.LayerTileView’.
For our application we use a common code set for WPF, Android, and iOS. The creation of the base map is identical in all 3 instances including the mechanism for setting up the cache. This problem does not exist if we do not use caching, and this problem only occurs with Android.
Problem does not occur if I let the map tiles fully paint prior to another zoom operation – only occurs if doing so before the screen fully updates. I can’ t exclude the possibility that our code is at fault, however I would expect it to fail in a similar way in the other platforms which it doesn’t