2012-03-18 38 views

回答

2

我已经使用在我的应用程序中的以下代码,它运行良好。

这里,

SADDR =源地址(纬度,经度)

DADDR =目标地址(纬度,经度)

请注意,您还可以通过地址字符串代替lat/lng。

public void showDirections(View view) { 
     final Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://maps.google.com/maps?" + "saddr="+ latitude + "," + longitude + "&daddr=" + latitude + "," + longitude)); 
     intent.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity"); 
     startActivity(intent); 
    } 

希望这将有助于...