I'm trying to use Google Maps with custom tiles. For this, I use the API demo's from Google:
https://github.com/googlemaps/android-samples
and as an example I used TileOverlayDemoActivity
as a base. Everything works as expected, but when you zoom in/out and the zoomlevel changes, all the tiles disappear and are being build up again, resulting in a gray screen of about one or two seconds. When you later-on zoom to this level again, the issue is not there, but, if you restart the app, it is there again!
Here is a recording I made from the API Demo's app (this is as-is, I have not changed anything) : https://www.youtube.com/watch?v=OZ3aqLOZ2CY
First I thought the downloading of the tiles took some time, so I tested with using a lightweight TileProvider
:
public class MyTileProvider implements TileProvider {
@Override
public Tile getTile(int i, int i1, int i2) {
return new Tile(256, 256, byteArray);
}
}
where byteArray
is always the same, created from a `Bitmap once:
ByteArrayOutputStream stream = new ByteArrayOutputStream();
b.compress(Bitmap.CompressFormat.PNG, 100, stream);
byteArray = stream.toByteArray();
But here, still the same issue.
I don't think there is a solution to this issue, as I haven't found any on the web.
But if someone has a workaround, I could accept that. I am thinking of trying to zoom in from top to bottom for each level so they are drawn once (as I don't see this issue after a zoomlevel has been drawn)