Rod*_*igo 5 android android-intent
我需要使用 sdcard 上已经存在的 kml 文件打开谷歌地图。(/sdcard/example.kml)
我试过:
这个答案是错误的,当点击链接时,地图打开,但搜索位置“file:///sdcard/example.kml”
此代码抛出ActivityNotFoundException
:
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("file:///sdcard/example.kml"));
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
另一个ActivityNotFoundException
:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(
Uri.parse("file:///sdcard/example.kml"),
"application/kml");
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
在 Android 上的 Google 地图中打开本地 KML 文件
知道如何打开这个kml吗?
谢谢!!!
您需要对 Intent 数据使用 geo URI 方案语法:
Uri.parse("geo:0,0?q=file:///sdcard/example.kml")
Run Code Online (Sandbox Code Playgroud)
这个答案中的代码对我有用: 如何在 MapView 上从谷歌地图绘制预构建地图
归档时间: |
|
查看次数: |
8164 次 |
最近记录: |