brian_89

ArcGISTiledMapServiceLayer initLayer

Discussion created by brian_89 on Nov 16, 2012
Latest reply on Dec 7, 2012 by Boesch
Hello

I coded my own OfflineTiledLayer based on the ArcGISTiledMapServiceLayer. The method "getTile" is overrided. The Tiles be stored at the SD Card as PNG Image.

Like this:
...
byte[] image = super.getTile(level, col, row);
Bitmap bmp = BitmapFactory.decodeByteArray(image, 0, image.length);
dir.mkdirs();
File file = new File(dir, cachedTileFile);
FileOutputStream fOut = new FileOutputStream(file);
bmp.compress(Bitmap.CompressFormat.JPEG, 80, fOut);
fOut.flush();
fOut.close();
...


When the Mobile Internet is deactiveted on the device and i start the app will crash (on initLayer).
The problem should be on the initLayer Method. How can i overide the initLayer that the app also work offline and load the tiles?

-> E/ArcGIS(26273): Caused by: libcore.io.ErrnoException: connect failed: ENETUNREACH (Network is unreachable)

Outcomes