android - 如何在android中打开导航而不是mapview?

标签 android android-layout android-mapview android-maps android-maps-v2

我已经绘制了位置,如果它被点击,它会转到 map 和从 map ,如果它被点击方向,它会打开谷歌导航。是否可以直接与导航链接?

我已经定义了这样的代码。

GeoPoint pt = item.getPoint();

String lat = Double.toString(pt.getLatitudeE6() / 1e6);

String lng = Double.toString(pt.getLongitudeE6() / 1e6);

intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q=" + lat + "," + lng));

在uri中,打开导航应该给什么?我想跳过第二张截图,直接

打开导航。如何做到这一点?

我的截图如下:

1st screenshot

2nd screenshot here

3rd screenshot

最佳答案

不过我找到了解决办法

Intent intent;
GeoPoint pt = item.getPoint();
String lat = Double.toString(pt.getLatitudeE6() / 1e6);
String lng = Double.toString(pt.getLongitudeE6() / 1e6);               
intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("google.navigation:q=" + lat + "," + lng));

关于android - 如何在android中打开导航而不是mapview?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15426611/

相关文章:

安卓 FileNotFoundException res/drawable-hdpi/scrollbar_handle_vertical.9.png

java - Android动态添加自定义组件到LinearLayout

android - 在单个 Activity 中跨多个 fragment 重用 Google Map v2

android - 使用 Sencha 的应用程序中的文本字段样式在 Android 设备上崩溃

java - 跳转到二进制文件中的特定位置

android - 是否可以将位图切成小块而不将整个东西加载到内存中?

android - 使用 android plot 绘制声音

android - 如何在点击它时获得 EditText 的值(value)?

android - 从 OverlayItem 打开 Activity

java - MapActivity 强制关闭,触摸事件鲁莽地触发