我在一个活动中有一个list view,它呈现从json响应中获得的列表值。

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);

现在,当用户滚动到列表视图的末尾时,我希望通过另一个rest调用加载更多详细信息。请帮助我如何执行此操作,以使适配器中的前一个数据不应更改,并且应在其下面追加当前数据。
提前谢谢。

最佳答案

有关无休止的滚动,请参阅这里的https://github.com/codepath/android_guides/wiki/Endless-Scrolling-with-AdapterViews-and-RecyclerView。对于每个customLoadMoreDataFromApi(page)调用将数据加载到适配器并调用notify data set changed..

关于android - 如何使用Volley请求在android中执行无限滚动,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30160596/

10-09 01:22
查看更多