AnsweredAssumed Answered

online routing task problem

Question asked by tohamix7 on May 29, 2016

when i run this code it does not give me any error put it stop at   Log.e("result" ,task.getNetworkDescription().getName());

 

 

RouteParameters parameters = null;

 

RouteTask task = null;

try {

 

  task = RouteTask.createOnlineRouteTask(

   "http://sampleserver6.arcgisonline.com/arcgis/rest/services/NetworkAnalysis/SanDiego/NAServer/Route", null);

 

  Log.e("result" ,task.getNetworkDescription().getName());

 

  parameters = task.retrieveDefaultRouteTaskParameters();

  Log.e("result" ,"142");

  parameters.setOutSpatialReference(mMap.getSpatialReference());

  NAFeaturesAsFeature naFeatures = new NAFeaturesAsFeature();

  Log.e("result" ,"1");

 

  Point startPoint = new Point(-119.866896, 36.793653);

  Point stopPoint = new Point(-119.853345, 36.795488);

 

  StopGraphic startPnt = new StopGraphic(startPoint);

  StopGraphic stopPnt = new StopGraphic(stopPoint);

  Log.e("result" ,"2");

 

  naFeatures.setFeatures(new Graphic[] {startPnt, stopPnt});

  naFeatures.setSpatialReference(mMap.getSpatialReference());

  parameters.setStops(naFeatures);

 

  RouteResult result = null;

  result = task.solve(parameters);

  Log.e("result" , result.getStops().toString()) ;

} catch (Exception e) {

  e.printStackTrace();

}

Outcomes