导航按钮不可见。
这是我在我的活动中调用的代码。
public void NavigatePath(){
Uri gmmIntentUri = Uri.parse("http://maps.google.com/maps?" + "saddr=" + Sourcelat + "," + Sourcelong + "&daddr=" + Destinationlat + "," + Destinationlong);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
}
请推荐我如何看到导航按钮。
答案 0 :(得分:1)
我正在使用它,它运作得很好:
String uri = String.format(Locale.ENGLISH, "http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", sourceLatitude, sourceLongitude, destinationLatitude, destinationLongitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
try
{
startActivity(intent);
}
catch(ActivityNotFoundException ex)
{
try
{
Intent unrestrictedIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(unrestrictedIntent);
}
catch(ActivityNotFoundException innerEx)
{
Toast.makeText(this, "Please install google maps application!", Toast.LENGTH_LONG).show();
}
}