Guest User

Untitled

a guest
Apr 13th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.30 KB | None | 0 0
  1. Retrofit retrofit = new Retrofit.Builder()
  2.                 .baseUrl("http://192.168.1.213/QuestionService/")
  3.                 .addConverterFactory(GsonConverterFactory.create())
  4.                 .build();
  5.         Log.wtf("aasd", "start");
  6.         IQuestionService service = retrofit.create(IQuestionService.class);
  7.         final ArrayList<Model> models = new ArrayList<>();
  8.         Call<List<Model>> call = service.getAnswers();
  9.  
  10.         try {
  11.             call.enqueue(
  12.                     new Callback<List<Model>>() {
  13.                         @Override
  14.                         public void onResponse(Call<List<Model>> call, Response<List<Model>> response) {
  15.                             Log.wtf("aasd", "response");
  16.                             for (Model m : response.body()
  17.                                     ) {
  18.                                 models.add(m);
  19.                             }
  20.                         }
  21.  
  22.                         @Override
  23.                         public void onFailure(Call<List<Model>> call, Throwable t) {
  24.                             Log.wtf("aasd", "fail");
  25.                             int a = 1 + 2;
  26.                             int b = 2 + a;
  27.                         }
  28.                     }
  29.             );
  30.         }
  31.         catch(Exception ex)
  32.         {
  33.  
  34.         }
Advertisement
Add Comment
Please, Sign In to add comment