# Interface RouteCallback

public interface RouteCallback
Receives the outcome of a routing request. Exactly one method is invoked per request, always on the Codename One event dispatch thread, so it is safe to touch the UI directly from either one.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `routeFailed(String message, Throwable error)`
  Reports that no route could be produced -- the network failed, the service rejected the request, or no road connects the points (routing across an ocean by car, for example).
  `void`
  `routesFound(List routes)`
  Delivers the routes found, best first.

- ## Method Details

  - ### routesFound

    void routesFound(List routes)
    Delivers the routes found, best first. The list holds at least one `Route` and only holds more when `RouteRequest.setAlternatives(boolean)` asked for alternatives and the backend found some.

  - ### routeFailed

    void routeFailed(String message, Throwable error)

    Reports that no route could be produced -- the network failed, the service rejected the request, or no road connects the points (routing across an ocean by car, for example).

    ###### Parameters

    - `message`: a human readable explanation, never `null`

    - `error`: the underlying exception when one was thrown, or `null` when the failure carried none -- a request rejected before it was sent, or an error status the service answered with. `message` stands on its own either way; `error` is there for logging and diagnostics.