Advertisement
Denisimus

Untitled

Jun 3rd, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.36 KB | None | 0 0
  1. public ResponseGooleMaps getRoute(LatLng startPoint, GeoAddress entdPoint) {
  2.  
  3.         String startPointCordinats = startPoint.latitude + "," + startPoint.longitude;
  4.  
  5.          ResponseGooleMaps[] body = new ResponseGooleMaps[1];
  6.  
  7.         googleMapApi.getRoute("false",
  8.                 "ru",
  9.                 "driving",
  10.                 startPointCordinats,
  11.                 entdPoint.getName(),
  12.                 GOOGLE_MAP_KEY).enqueue(new Callback<ResponseGooleMaps>() {
  13.  
  14.             @Override
  15.             public void onResponse(Call<ResponseGooleMaps> call, Response<ResponseGooleMaps> response) {
  16.                 if (response.isSuccessful()) {
  17.                      body[0] = response.body();
  18.  
  19.  
  20.                     Log.d(LOG_TEG, "overview_polyline \n" + body[0]);
  21.  
  22.                 } else {
  23.                     try {
  24.  
  25.                         response.errorBody().string();
  26.                         //TODO finish the text of an error
  27.                         Log.e(LOG_TEG, " errorBody: " + response.errorBody().string());
  28.  
  29.  
  30.                     } catch (IOException e) {
  31.                         e.printStackTrace();
  32.                     }
  33.                 }
  34.             }
  35.  
  36.  
  37.              @Override
  38.             public void onFailure(Call<ResponseGooleMaps> call, Throwable t) {
  39.                 //TODO
  40.  
  41.             }
  42.         });
  43.  
  44.  
  45.         return body[0];
  46.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement