I'm using a ListAdapter for one of my projects. An...
# android
s
I'm using a ListAdapter for one of my projects. And i noticed that submitting a large list of items adapter.submitList(200+ items), is blocking the UI thread. Diffutil calculation was supposed to happen in background thread according to documentation. I'm confused what's happening. Am I missing something?
s
Can you share your implementation of the DiffUtil? Maybe something's going wrong there and the recyclerview has to update all 200+ items
👍 1
s
j
Perhaps it is your RecyclerView within a NestedScrollView? I never really use it, but you should check if your items are all drawn, or only the visible ones
s
Ya it's in nestedscolview but with nestedscollinhEnabled set to false, also after the lag is done, I'm able to scroll smoothly over the entire list of items. I'm guessing something going wrong while drawing UI. Not really sure what's that
j
can you check how many of the 100 views are drawn the first time?
s
It's like, after submitList, it lags like 5-10 seconds, then suddenly all items are drawn. Entire list
j
I think that is the issue
💯 1
recyclerview should only draw the visible views
not the entire list
so perhaps your listView expands the whole height
instead of the viewport only
what might be because of the nesting
s
Maybe because it's inside nestedrecycleeview.
j
yep, so you should check that out
s
Is that actual behaviour? When a recyclerview is inside nestedrecycleeview with nested scrolll false, does it actually draw entire view?
j
I am not sure about it
s
Ya probably. Checking it right away
Moving out of recyclerview
j
also I am not sure which flags to use within to avoid that
also you have the recyclerview nested within a linearlayout as well
s
Nestedscrollview*
@Joost Klitsie damn bro that's the issue. I moved
I moved recyclerview out of nestedscrollview
And it's working fine now. Seems like recyclerview features aren't available inside nestedscrollview if nestedscollinhEnabled=false. Need to confirm on this though.
Outside of nestedscrollview, it's behaving normally. Thanks much man. I was not suspecting on nestedscrollview itself.
👍 1