Java Code Examples for android.content.Intent#getIntent()

The following examples show how to use android.content.Intent#getIntent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Adapter_FoodDelivery.java    From FoodOrdering with Apache License 2.0 6 votes vote down vote up
/**
 * 注意下面的起终点坐标都是百度坐标,如果使用高德坐标系有很大的误差
 * mode=driving 指定导航方式,这里是驾车(riding是骑行)
 */
void setUpBaiduAPPByLoca() {
    try {
        LATITUDE_QIDIAN=Activity_FoodDelivery.latitude;
        LONGTITUDE_QIDIAN=Activity_FoodDelivery.longitude;
        ADDRESS_QIDIAN=Activity_FoodDelivery.address;
        Util.showToast(mContext,"导航起点:"+LATITUDE_QIDIAN+"/"+LONGTITUDE_QIDIAN+" "+ADDRESS_QIDIAN);
        Intent intent = Intent.getIntent("intent://map/direction?origin=latlng:" + LATITUDE_QIDIAN + "," + LONGTITUDE_QIDIAN + "|name:" + ADDRESS_QIDIAN + "&destination=latlng:" + LATITUDE_ZHONGDIAN + "," + LONGTITUDE_ZHONGDIAN + "|name:" + ADDRESS_ZHONGDIAN + "&mode=riding&src=yourCompanyName|yourAppName#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end");
        if (isInstallByread("com.baidu.BaiduMap")) {
            mContext.startActivity(intent);

        } else {
            Util.showToast(mContext, "没有安装百度地图客户端");
        }
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
}
 
Example 2
Source File: NavUtil.java    From Mobike with Apache License 2.0 6 votes vote down vote up
/**
 * 通过Uri跳转到百度地图导航
 */
public static void startNative_Baidu(Activity activity, LatLng pt1, LatLng pt2, String start_address, String end_address) {
    try {
        double dis = DistanceUtil.getDistance(new LatLng(pt1.latitude,pt1.longitude), new LatLng(pt2.latitude,pt2.longitude));
        if (dis <= 100) {
            Toast.makeText(activity, "起点、途经点、终点距离太近", Toast.LENGTH_SHORT).show();
            return;
        }
        String start_latlng = pt1.latitude + "," + pt1.longitude;
        String end_latlng = pt2.latitude + "," + pt2.longitude;
        Intent intent = Intent.getIntent("intent://map/direction?origin=latlng:"+start_latlng+"|name:"+"Start"+"&destination=latlng:"+end_latlng+"|name:"+"End"+"&mode=riding&src=这里随便写#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end");
        Log.d("gaolei", "---------------" + start_address + "," + end_address);
        activity.startActivity(intent);
    } catch (Exception e) {
        e.printStackTrace();
        Toast.makeText(activity, "地址解析错误", Toast.LENGTH_SHORT).show();
    }
}