Boy Boy - 11 months ago 86
Android Question

Google maps custom tiles load slow

I'm trying to use Google Maps with custom tiles. For this, I use the API demo's from Google:

and as an example I used

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) :

First I thought the downloading of the tiles took some time, so I tested with using a lightweight

public class MyTileProvider implements TileProvider {

public Tile getTile(int i, int i1, int i2) {
return new Tile(256, 256, 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)

Boy Boy
Answer Source

I have a workaround for this and answered it on a different question here