springoff

find-route sample 100.2.0 (how to set points A and B in the map)

Discussion created by springoff on Feb 8, 2018

Hi again! Im testing the find-route sample on github and im fighting to get the points A and B (stops defined for routing) editable and not fixed like showing in the sample.

 

In the previous SDK release sample for routing we have a OnLongTouchListener to mark points.

 

One way to get this done is to put a counter in the listener:

 

First long touch -> Gets point A

Second long touch  -> Gets point B

Third long touch -> Clear all points and start again.

 

The route task only get results if points A and B have values.

 

Need some help to get this working in this way or another (be my guest if you have a solution!) 

 

final ListenableFuture<RouteParameters> listenableFuture = mRouteTask.createDefaultParametersAsync();
listenableFuture.addDoneListener(new Runnable() {
    @Override
    public void run() {
        try {
            if (listenableFuture.isDone()) {
                int i = 0;
                mRouteParams = listenableFuture.get();

                // create stops
                Stop stop1 =  new Stop(new Point(-117.15083257944445, 32.741123367963446, SpatialReferences.getWgs84()));

                Stop stop2 = new Stop(new Point(-117.15557279683529, 32.703360305883045, SpatialReferences.getWgs84()));

                List<Stop> routeStops = new ArrayList<>();
                // add stops
                routeStops.add(stop1);
                routeStops.add(stop2);
                mRouteParams.setStops(routeStops);

Outcomes