Can't load tile image from internal storage
See original GitHub issueUsing TileView 3.0.1, I tried to load tile images from internal storage but it doesn’t seems to work. My initialization code is:
.setSize(4000, 6000)
.setTileSize(256)
.defineZoomLevel(2, "/storage/emulated/0/Android/data/tileview.demo/files/3-%1$d-%2$d.jpg")
.defineZoomLevel(1, "/storage/emulated/0/Android/data/tileview.demo/files/4-%1$d-%2$d.jpg")
.defineZoomLevel(0, "/storage/emulated/0/Android/data/tileview.demo/files/5-%1$d-%2$d.jpg")
.setStreamProvider(new StreamProviderFiles())
.build();
Checking the source code of Tile class, I noticed that an exception was raised in decode()
on stream.reset()
=> java.io.IOException: mark/reset not supported
I managed to avoid this error wrapping the FileInputStream into a BufferedInputStream or resetting the stream using mStreamProvider.getStream(mColumn, mRow, context, mDetail.getData());
again but a new problem appeared.
Tiles are now visible but there is random glitch on my map and I noticed this kind of errors in logcat:
D/skia: libjpeg error 105 < Ss=0, Se=63, Ah=0, Al=0> from Incomplete image data
D/skia: libjpeg error 116 <Corrupt JPEG data: 6593 extraneous bytes before marker 0xd9> from output_message
D/skia: libjpeg error 51 <JPEG datastream contains no image> from output_message
D/skia: libjpeg error 51 <JPEG datastream contains no image> from setjmp
Using the demo project with my custom images in asset folder works fine so I am sure that my images are fine.
Changing this solve the problem:
public TileRenderExecutor() {
this(1); //instead of Runtime.getRuntime().availableProcessors()
}
but it’s obviously not a good solution.
Thanks for your help.
Issue Analytics
- State:
- Created 4 years ago
- Comments:19 (13 by maintainers)
Top GitHub Comments
Version 4 is out, including a demo with files in both SD card and internal store
Closing fixed.
hm so apparently it’s something today with stream carets for local files. i’m getting “Mark was invalidated”. This was apparently a big thing during the old UIL days with similar stream handling around local files. I’ve got to shut down for now, but I feel like this is a solvable problem, and definitely a bug introduced when moving from Bitmaps to Streams. I hope to have this solved soon, and will keep this thread updated. Off for now