2012-03-18 64 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); 
    } 

希望這將有助於...