android百度地图的PlanNode.withCityNameAndPlaceName();无法解析地址的经纬度?

我调用百度地图路线规划函数,传入两个PlanNode对象,然后路线规划失败了,提示的错误是地址存在歧义,是因为PlanNode无法解析出经纬度吗?下面贴出代码:

    PlanNode splanNode = PlanNode.withCityNameAndPlaceName("佛山", "狮山镇");
    Log.d("Location", String.valueOf(splanNode.getLocation()));

上面代码输出为null。

    PlanNode stNode = PlanNode.withCityNameAndPlaceName("北京", "龙泽");
    PlanNode enNode = PlanNode.withCityNameAndPlaceName("北京", "西单");
    mRouteSearch.bikingSearch(new BikingRoutePlanOption().from(stNode).to(enNode));

    public void onGetBikingRouteResult(BikingRouteResult bikingRouteResult) {
                if (bikingRouteResult!=null){
                    Toast.makeText(getActivity().getApplicationContext(), "aaa", Toast.LENGTH_SHORT).show();
                }
                if (bikingRouteResult.error == SearchResult.ERRORNO.AMBIGUOUS_ROURE_ADDR){
                    Toast.makeText(getActivity().getApplicationContext(), "地址有歧义", Toast.LENGTH_SHORT).show();
                }
                if (bikingRouteResult.error == BikingRouteResult.ERRORNO.PERMISSION_UNFINISHED){
                    Toast.makeText(getActivity().getApplicationContext(), "没有权限", Toast.LENGTH_SHORT).show();
                }
                if (bikingRouteResult ==null || bikingRouteResult.error != BikingRouteResult.ERRORNO.NO_ERROR){
                    Toast.makeText(getActivity().getApplicationContext(), "未找到结果", Toast.LENGTH_SHORT).show();
                }
                if (bikingRouteResult.error == BikingRouteResult.ERRORNO.NO_ERROR){
                    Toast.makeText(getActivity().getApplicationContext(), "worked!", Toast.LENGTH_SHORT).show();
                }
            }

上面为路线规划代码。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!