我在一个 Activity 中有一个 ListView ,它呈现从 JSON 响应中获得的列表值。我能够成功地显示 ListView ,代码如下所示
listView = (ListView) findViewById(R.id.list);
adapter = new CustomListAdapter(this, productList);
listView.setAdapter(adapter);
pDialog = new ProgressDialog(this);
// Showing progress dialog before making http request
pDialog.setMessage("Loading...");
pDialog.show();
GsonRequest<Product[]> getPersons =
new GsonRequest<Product[]>(Request.Method.GET,url, Product[].class,
requestSuccessListener(), requestErrorListener());
AppController.getInstance().addToRequestQueue(getPersons);
现在,当用户滚动到 ListView 的末尾时,我想通过另一个 REST 调用加载更多详细信息。请帮助我了解如何执行此操作,以便适配器中以前的数据不应该被更改并且现在应该附加在它下面。
提前致谢。
最佳答案
无限滚动请引用此处 https://github.com/codepath/android_guides/wiki/Endless-Scrolling-with-AdapterViews-and-RecyclerView .. 对于每个 customLoadMoreDataFromApi(page)
调用将数据加载到适配器并调用通知数据集已更改..
关于android - 如何使用 Volley 请求在 android 中执行无限滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30160596/