I have 2 requests that are sent using retrofit.
The first request sent, received a response in the onResponse method itself response.body - this is the list, but it is in the onResponse method.
I send 2 request and actually get an answer, also a list of response.body.
I can not understand How to add data to the list from which the adapter takes the data? Well, as far as I know, update it?
final Call<ArrayList<ProductModel>> call = (Call<ArrayList<ProductModel>>) service.getProducts("pagin.php","asda", 0); call.enqueue(new Callback<ArrayList<ProductModel>>() { @Override public void onResponse(Call<ArrayList<ProductModel>> call, Response<ArrayList<ProductModel>> response) { if (response.code() == 200) { for (ProductModel model : response.body()) { a[0] = a[0] + model.getNameProduct(); Log.d("myfirst",a[0]); adapter = new RecyclerAdapter(response.body(), ProductsActivity.this); rv.setAdapter(adapter); }