简体   繁体   中英

Filter a recycler view with search view in Android

I'm implementing the search view filtering logic on my recycler views in Android. My step is similar to what is discussed here .

It works, but the problem is when the query string is short, for example, empty string or single character string, it takes a the cursor freezes for about 1 second before I can type another character. I think this has something to do with the UI rendering (a lot more contacts are being rendered at this time).

Any idea on how to resolve this issue to make the filtering more smooth? Thank you for any advice in advance.

Edit: I have over 400 contacts in my phone. It works perfectly with less than 100 contacts.

you obviously should fetch data in other threads. because this way allows you to fetch without any lag. find more about threads in java

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM