Android – 如何使用Intent和KML打开谷歌地图?

我需要使用已存在于SD卡上的kml文件打开谷歌地图. (/sdcard/example.kml)

我试过了:

> Open local KML File in Google Maps on Android

这个答案是错误的,当点击链接,地图打开,但搜索位置“file:///sdcard/example.kml”

>使用意图:

此代码抛出ActivityNotFoundException:

Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
        Uri.parse("file:///sdcard/example.kml"));
startActivity(intent);

>我尝试使用setDataAndType方法,但不起作用:

另一个ActivityNotFoundException:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(
         Uri.parse("file:///sdcard/example.kml"),
                   "application/kml");
startActivity(intent);

>关于此问题的其他两个未解决的主题:

Open local KML File in Google Maps on Android

Does the Android API support KML files?

知道怎么打开这个kml?

谢谢!!!

最佳答案 我正在使用Locus Free(来自市场),这是一个地图遮阳板,能够打开像谷歌地图捕获的.kml文件,但是能够从谷歌导入.kml文件,它确实不要让你看到卫星视图,只有你添加到它的标记和一些地形特征,如道路和地名.

点赞