onItemAtEndLoaded is called immediately after onZeroItemsLoaded
Asked Answered
S

1

14

I have a problem where the method onItemAtEndLoaded is called immediately after onZeroItemsLoaded, the behavior should be only when I finish the scroll. Do you have any idea of what is happening. I can provide my GitHub repo.

Stylolite answered 31/7, 2018 at 22:31 Comment(0)
N
1

I have solved it by setting PrefetchDistance to zero in PagedListConfig

PagedList.Config.Builder()
                .setPrefetchDistance(0) // solved
                .setInitialLoadSizeHint(pageSize)
                .setPageSize(pageSize)
Neve answered 19/9, 2018 at 9:49 Comment(7)
hi, it seems to me as the correct answer, I read in the documentation too, as I understand these arguments here. though now onItemAtEndLoaded never gets called now after changing into this.Sholem
Which data source are you using?Neve
Thanks Malmaison for replying, DataSource.factory< int, my class>Sholem
I use the Google codelab for learning and implementing this, mithun search one, their search api take page_no and limit while mine takes an offsetId ( fetch item with higher id ) and limitSholem
Actually, this thought has come to my mind that it being not working might have to do with the type of data sourceSholem
I am not sure at the moment. I will check it out for you.Neve
hey it worked, actually, I did a mistake, my adapter was still extending ListAdapter instead of PagedListAdapter. I am another problem, how to tell BoundryCallBack that it has to fetch all from the network. My app is crashing when it gets 0 items.Sholem

© 2022 - 2024 — McMap. All rights reserved.