我需要使用 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吗?
谢谢!!!
我已经通过谷歌地图路由添加了当前位置
Routing routing = new Routing.Builder()
.travelMode(Routing.TravelMode.DRIVING)
.key(getResources().getString(R.string.google_maps_api))
.withListener(this)
.waypoints(new LatLng(mLastKnownLocation.getLatitude(), mLastKnownLocation.getLongitude()), site_location)
.alternativeRoutes(false)
.build();
routing.execute();
@Override
public void onRoutingSuccess(ArrayList<Route> route, int shortestRouteIndex) {
if (polylines.size() > 0) {
for (Polyline poly : polylines) {
poly.remove();
}
}
polylines = new ArrayList<>();
//add route(s) to the map.
for (int i = 0; i < route.size(); i++) {
//In case of more than 5 alternative routes
int colorIndex = i % COLORS.length;
PolylineOptions polyOptions = new PolylineOptions();
polyOptions.color(getResources().getColor(COLORS[colorIndex]));
polyOptions.width(10 + i …Run Code Online (Sandbox Code Playgroud) android google-maps google-maps-markers google-maps-android-api-2
我想在不显示"完整操作对话框"的情况下调用谷歌地图意图?
可能吗?这是我的代码.
String uri = "http://maps.google.com/maps?saddr=" + Utils.getLatitude(ShowDetails.this)+","+Utils.getLongitude(ShowDetails.this)+"&daddr="+userLatitude+","+userLongitude;
startActivity(new Intent(android.content.Intent.ACTION_DEFAULT, Uri.parse(uri)));
Run Code Online (Sandbox Code Playgroud)
我不想在调用谷歌地图意图时显示在下面的对话框中.任何帮助表示赞赏.

我的客户要我展示两个地点之间的路线.因此他希望我们的应用程序应该启动android的地图应用程序并在两个位置之间显示方向.我找不到解决这个问题的方法.
因此,有人可以告诉我如何以编程方式从我们当前的应用程序启动地图应用程序,并在Android中的两个位置之间显示方向.
请发给我任何示例代码或教程以实现此目的.
我在Android应用程序中工作,我有两个Geo点.我希望用户从我的应用程序重定向到谷歌地图android应用程序,以显示地图中的方向.如何将两个地理位置传递到谷歌地图android应用程序以显示谷歌地图应用程序中的方向.
我对创建一个按钮感兴趣,该按钮将立即启动Google Maps应用并开始将导航驱动到特定地址。这可能吗?如果是这样,API是什么?
我希望它立即开始导航,而不会强迫用户在不同的路线选项之间进行选择。
android google-maps google-maps-api-3 google-maps-android-api-2 android-maps-v2
我想按纬度和经度显示谷歌地图.
然而我正在使用Address来显示Gmap.
这是我的代码:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("geo:0,0?q=" + ("2100 California St., Eureka, CA")));
try {
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
我想按纬度和经度显示地图.
提前致谢.