File paging with volley

So I want to fetch images for a wallpaper app in android without using Backendless API.I used volley and it works but when I am using “pageSize” and “offset” as stated in one of docs.I am getting some files repeated in next set of images.

Hi Vikram

Please provide us request examples what return duplicates, maybe CURLs or a code snippet what we can run to reproduce the issue

Regards, Vlad

Hi here is a snippet from my android code.I am getting same files repeated some times.I am getting files from a folder in Backendless’s FILE system.

 mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);

            visibleItemCounter = mRecyclerView.getChildCount();
            totalItemCounter = mGridLayoutManager.getItemCount();
            firstVisibleItem = mGridLayoutManager.findFirstVisibleItemPosition();

            if (processingNewItem) {
                if (totalItemCounter > previousTotalItem) {
                    processingNewItem = false;
                    previousTotalItem = totalItemCounter;
                    pageCounter++;
                }
            }

            if (!processingNewItem && (totalItemCounter - visibleItemCounter) <= (firstVisibleItem + visibleThresholdItem)) {
                Snackbar.make(mRecyclerView, "Loading More Pictures...",
                        Snackbar.LENGTH_LONG).show();
                mPictureUrl = ApiUrls.PICTURE_BASE_URL + "?"+ApiUrls.PAGE_OFFSET + "=" + String.valueOf(pageCounter) +
                        "&" + ApiUrls.PER_PAGE_ITEM_OFFSET + "=" + "15";
                getPictureListData(mPictureUrl);
                Log.d(TAG,mPictureUrl);
                processingNewItem = true;
            }
        }

And also pay attention, that if you added the records to the table between two ‘get’ requests, then it can happen.

There is no other CRUD methods in my app except GET.
https://api.backendless.com/APPID/RESTAPIKEY/files/FOLDERNAME?offset=1&pagesize15;
https://api.backendless.com/APPID/RESTAPIKEY/files/FOLDERNAME?offset=2&pagesize15;
and so on is the api call precisely.

I see, you use wrong “offset” it should be 0 for the first request and 15 for the second
see the doc: https://backendless.com/docs/js/data_data_paging.html

‘offset’ means the amount of records that must be skipped.

Thank you for the help I managed to solve it.Great community.
Is there a way to generate thumbnail for all images using Backendless.

Thank you for the quick help.It works now.

Please, see this article. It may help you to understand how to use backendless to create thumbnails.
https://backendless.com/how-to-split-images-into-small-medium-and-high-resolutions-with-backendless-api-service/