通过让我点到终点绘制路线 [英] Draw route by getting my point to destination point

查看:149
本文介绍了通过让我点到终点绘制路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  String uri = "http://maps.google.com/maps?saddr=" + src_lat+","+src_lon+"&daddr="+des_lat1+","+des_lon1;
   Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
   intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
   startActivity(intent);

下面是code代表其中源和目的地的纬度和经度是已知的两个位置之间画一条路线。但在这里我想取代我的位置的经度和纬度 src_lon src_lat ,其值我不知道,这经度和纬度都与我目前的位置变化。是否可以得出这样一个类型的路由?

Here is the code for drawing a route between two locations where both the source and destination's latitude and longitude are known. But here I want to replace my location's longitude and latitude to src_lon and src_lat, whose values I do not know and this longitude and latitude are changed with my current location. Is it possible to draw such a type of route?

推荐答案

试试这个:

Intent i = new Intent(android.content.Intent.ACTION_VIEW,
       Uri.parse("google.navigation:q=" +destLat+ ","+destLon+""));
this.startActivity(i);

这是最好的解决方案,我知道了。

This is the best the solution I know.

这篇关于通过让我点到终点绘制路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆