I need to make a load on the end of the list, I have 20 items, when I get to the end, I need 20 more.
Currently my Fragment that loads the ads is as follows below.
new AsyncHttpClient().get(Constantes.URL_WS_BASE + "anuncio/list", new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
if(response != null) {
Type type = new TypeToken<List<Anuncio>>() {}.getType ();
anuncios = new Gson().fromJson(response.toString(), type);
AnuncioRecyclerAdapter adapter = new AnuncioRecyclerAdapter(anuncios);
rv.setAdapter(adapter);
} else {
Toast.makeText(getActivity(), "Houve um erro ao carregar a lista de anúncios.", Toast.LENGTH_LONG).show();
}
lytLoading.setVisibility(View.GONE);
}
@Override
public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
super.onFailure(statusCode, headers, responseString, throwable);
Toast.makeText(getActivity(), "Falha: " + responseString, Toast.LENGTH_LONG).show();
}
});