Display kml file using the Google Maps v2 Android API indiscriminately

I have a kml file (locally locally) that I want to show on Maps in the application I'm developing. In my search, I ended up in this post: How to draw a path on a map using a kml file? repeatedly. I find this method quite lengthy. I just want to show the markers defined by my kml file. Is there any way to do this without parsing the file? after all, both kml and the Maps API are Google. Is there no way to say that the API loads a map based on a specific kml file?

+6
source share
2 answers

Is there any way to do this without parsing the file?

Currently.

after all, both kml and the Maps API are Google.

There are also Google Docs, but the API does not allow you to upload a spreadsheet to your map.

Is there no way to say that the API loads a map based on a specific kml file?

Not now, sorry. You might want to keep an eye on this feature to see if it is being added and when it is being added.

+5
source

It is possible to create a KML file in Google Earth on a PC. Then put this file on the SD card and you can call this KML file into this activity. But a prerequisite for work is that the device requires Google Earth.

public void buttonClicked(View view) {Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); File file = new File("/sdcard/APK/trek1.kml"); intent.setDataAndType(Uri.fromFile(file), "application/vnd.google-earth.kml+xml"); startActivity(intent); } 

Perhaps you know that.

0
source

Source: https://habr.com/ru/post/958141/


All Articles