Advertisement
Guest User

Untitled

a guest
May 25th, 2018
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.19 KB | None | 0 0
  1. public class ControllerReview implements Callback<List<reviewResult>> {
  2.  
  3.     public Context context;
  4.  
  5.     static final String BASE_URL = "http://busboosted.000webhostapp.com/";
  6.  
  7.     public void start(final Context context, String login, String password, Callback<List<reviewResult>> callback) {
  8.         Gson gson = new GsonBuilder()
  9.                 .setLenient()
  10.                 .create();
  11.  
  12.         this.context = context;
  13.  
  14.         Retrofit retrofit = new Retrofit.Builder()
  15.                 .baseUrl(BASE_URL)
  16.                 .addConverterFactory(GsonConverterFactory.create(gson))
  17.                 .build();
  18.        
  19.         Api gerritAPI = retrofit.create(Api.class);
  20.  
  21.         Call<List<reviewResult>> call = gerritAPI.getReview();
  22.  
  23.         call.enqueue(new Callback<List<reviewResult>>() {
  24.             @Override
  25.             public void onResponse(Call<List<reviewResult>> call, Response<List<reviewResult>> response) {
  26.                 List<reviewResult> res = response.body();
  27.                 res.getReview();//how to get a list?
  28.             }
  29.  
  30.             @Override
  31.             public void onFailure(Call<List<reviewResult>> call, Throwable t) {
  32.  
  33.             }
  34.         });
  35.  
  36.  
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement