默认的经纬度为:
double lat = 32.982022;
double longt = 119.780574;
1.
public static Uri getAddressMapUri(double lat, double longt, String result)
{
DecimalFormat decimalFormat = new DecimalFormat("###.######");
StringBuffer sb = new StringBuffer("geo:");
sb.append(decimalFormat.format(lat));
sb.append(',');
sb.append(decimalFormat.format(longt));
sb.append("?q=");
sb.append(decimalFormat.format(lat));
sb.append(",");
sb.append(decimalFormat.format(longt));
sb.append("(+").append(result).append("+)");
sb.append("?z=15");
return Uri.parse(sb.toString());
}
Uri uri = getAddressMapUri(VoiceApplication.getInstance().getLat(), VoiceApplication.getInstance().getLongt(),getResult);
Intent intent = new Intent("android.intent.action.VIEW", uri);
intent.setPackage("com.baidu.BaiduMap");
startActivity(intent);
2.
String url = "http://api.map.baidu.com/direction?
origin=33.988177,118.786991&destination=32.047616,118.790609&mode=driving&output
="
Uri uri = Uri.parse(url);
intent = new Intent(Intent.ACTION_VIEW);
intent.setData(uri);
intent.setPackage(com.baidu.BaiduMap);
mContext.startActivity(intent);
3.
String uri = "intent://map/direction?origin=name:从这里开始|latlng:31.988153
,118.786834
&destination=name:到这里结束|latlng:32.047615,118.790609
&coord_type
=bd09ll&mode=navigation#Intent;scheme=bdapp;package
=com.baidu.BaiduMap;end";
intent = Intent.parseUri(uri, 0);
mContext.startActivity(intent);