0

I have a maps which has marker. I want to add a KML layer on it to show a KML from google thanks to a KMZ file. But, when I add the new layer, the custom marker is no longer appearing.

I'm using this code:

(childFragmentManager.findFragmentById(R.id.googleMap) as SupportMapFragment).getMapAsync { map ->
   map.clear()

   map.setInfoWindowAdapter(GoogleMapWindow())
   // now I add all of my markers

   val content = resources.openRawResource(R.raw.carte)
   val layer = KmlLayer(map, content, context) // this line breaks the marker
   layer.addLayerToMap()
}

The GoogleMapWindow is like this:

class GoogleMapWindow() : InfoWindowAdapter {

    override fun getInfoWindow(marker: Marker): View {
        return TextView("My custom marker text") // example of code
    }
}

Before adding the new layer, the generated layout were appearing. Now, it's not the case.

I tried to set the adapter after and before adding the new layer but this didn't changed anything.

How can I add the new layer without break my custom info window?

1 Answer 1

0

My only trick to find a solution to this is to add a button to switch between layers (and so, hide the second one).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.