mon*_*yag 16 android google-maps
如何用方向打开地图意图?
我知道
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.format(Locale.US, "geo:%.8f,%.8f", latitude, longitude)));
startActivity(Intent.createChooser(intent, "Select an application"));
Run Code Online (Sandbox Code Playgroud)
此代码适用于一点.但我希望显示所有地图应用程序的对话框,并使用任何应用程序(Google Map,Citymapper,Web浏览器等)打开从A点到B点的路线.
Col*_*ire 30
你试过这个吗?
String uri = "http://maps.google.com/maps?f=d&hl=en&saddr="+latitude1+","+longitude1+"&daddr="+latitude2+","+longitude2;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(Intent.createChooser(intent, "Select an application"));
Run Code Online (Sandbox Code Playgroud)
小智 6
尝试这个
Uri uri = Uri.parse("geo:" + latitude1 + "," + longitude1 + "?q=" + Uri.encode(latitude2 + "," + longitude2 + "(" +Label+ ")"));
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, uri);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12681 次 |
| 最近记录: |