based on this link "https://developers.google.com/maps/documentation/android-api/utility/kml" I have followed it until to the point where I have to type this code:
KmlLayer layer = new KmlLayer(getMap(), R.raw.kmlFile, getApplicationContext());
I'm having a red line in 'getMap()' and 'R.raw.kmlFile' and I can't understand what it's trying to say in the part where he says
***To import and render a KML dataset from a local resource, you need:
A GoogleMap object where the layer is to be rendered. A local resource file containing the KML data. A Context object, which is required to open a local resource file.***
Can you please guide me on what to do.
You need to get map and then add a KML layer on top of it. Something like that:
...
private GoogleMap mMap;
...
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
...
}
...
public void addKML() {
KmlLayer layer = new KmlLayer(mMap, R.raw.kmlFile, getApplicationContext());
layer.addLayerToMap();
}
...