I need to make multiple calls to API REST with Retrofit and show the response in a ListView
, but I don't know how to do this and this code doesn't work.
Model
@GET("apks/{sha256}")
Call<DatoAPI> getTask2(@Path("sha256") String hash, @Query("Authorization") String key);
Implementation
for (String s: hash) {
Call<DatoAPI> call = services.getTask2(s, API.API_KEY);
call.enqueue(new Callback<DatoAPI>() {
@Override
public void onResponse(Call<DatoAPI> call, Response<DatoAPI> response) {
if (response.isSuccessful()) {
datoAPI = response.body();
items.add(datoAPI.getApp());
}
}
@Override
public void onFailure(Call<DatoAPI> call, Throwable t) {
Toast.makeText(getApplicationContext(),t.getMessage(),Toast.LENGTH_LONG).show();
}
});
}
Also I tried with call.execute()
and same problem
I want to show this response in a ListView
but it doesn't work.