【发布时间】:2017-12-04 05:54:35
【问题描述】:
我正在尝试在RecyclerView 中使用volley 在android 中解析JSONArray,我每页有10 个数据,当我们每次向下滚动recyclerview 时,如何调用next page url?
我的 JsonArray
"data": {
"total": 146,
"per_page": 10,
"current_page": 1,
"last_page": 15,
"next_page_url": "http://www.xxxxxxxxxx.com/api/v1/auth/deal?page=2",
"prev_page_url": null,
"from": 1,
"to": 10,
"data": [
{
"id": "209",
"ref": "101hd-209",
"pid": "437",
"name": "Office For Rent",
"deal_mode": {
"id": "128",
"category_name": "Lease"
},
我的recyclerview 一次加载第一页数据,现在向下滚动我如何调用下一个page url 来加载下一页数据。
【问题讨论】:
-
最简单的方法是在
onBindViewHolder检查if((list.size()==(position-1)))如果为真,然后回调活动或片段并将下一页添加到适配器中的列表。 -
你用
next_page_url回调了吗? -
在将下一页添加到您的适配器后不要忘记致电
notifyDataSetChanged() -
谢谢,成功了
-
不客气。
标签: android json android-recyclerview android-volley