Filter list to database

Hello, I have a recycleview and an adapter to fill it but I have problems filtering a search within the list, my list is not local, my list is received from a function that is responsible for loading it to display it in a fragment, I have implemented several types of search methods but it simply does not show me anything from the list, my list is only replaced by an empty one without showing me anything… i need help

It’s hard to tell what the problem really is or how to solve it without code. From what I can tell, you have a function that returns a list:

fun provideList(): List<String>

(element type may be different)
And you want to filter that list?

In that case, you’d just do:

provideList().filter { /*your condition*/ }

For example:

provideList().filter { it.startsWith(userInput) }

Note that filter returns a new, immutable List and leaves the original list it was called on untouched.

Hello, it turns out that I managed to adapt my filter to my recycler, but I have a question… although I don’t like to bother much, I have a layout that works as a nav_header, for a drawer menu, but I have 2 information parameters that I want to send to that nav header according to the user, but I can’t find how, I want to know if I can use the layout of an activity or fragment as a drawer menu nav header? Or if I can use an adapter class to send the information to that layout? In case that is not possible, how can I call my layout nav_header, from the activity where my drawer menu is configured, to change the items already created in it, for ones that come from a database where the user is saved? I summarize everything… how can I make the user’s profile photo and name appear in the nav header of my menu? Would any of the previous methods work or am I very wrong?

I have no idea, but it sounds like a question more suited for dedicated android development forums