Рассчитать кратчайший путь между двумя географическими точками?

Я новичок в Java и Android. Мне нужно найти кратчайший путь между двумя точками. Я весь день искал ответ, и я только что получил этот код:

var directionDisplay;
  var directionsService = new google.maps.DirectionsService();
  var map;

  function initialize() {
    directionsDisplay = new google.maps.DirectionsRenderer();
    var chicago = new google.maps.LatLng(41.850033, -87.6500523);
    var myOptions = {
      zoom:7,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      center: chicago
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    directionsDisplay.setMap(map);
  }

  function calcRoute() {
    var start = document.getElementById("start").value;
    var end = document.getElementById("end").value;
    var request = {
        origin:start, 
        destination:end,
        travelMode: google.maps.DirectionsTravelMode.DRIVING
    };
    directionsService.route(request, function(response, status) {
      if (status == google.maps.DirectionsStatus.OK) {
        routePath = result.routes[0].overview_path;
        for(var a = 0; a< routePath.length; a++){
          // Your vector layer to render points with line
        }
        directionsDisplay.setDirections(response);
      }
    });
  }

Основной код здесь:

      directionsService.route(request, function(response, status) {
              if (status == google.maps.DirectionsStatus.OK) {
                routePath = result.routes[0].overview_path;
                for(var a = 0; a< routePath.length; a++){
                  // Your vector layer to render points with line
                }
                directionsDisplay.setDirections(response);
              }
            });

Проблема в том, что я хочу реализовать этот код в Android. но я не знаю как. Кто-нибудь знает, как изменить код, чтобы я мог использовать его в Android?

Здесь ссылка на источникЭтот

Ответы на вопрос(1)

Ваш ответ на вопрос