My main-activity is holding 3 fragments, that holding the adapter. Any ideas what I can do? I can not call the adapter in onQueryTextChange in the main activity, because the adapter is created in the fragment. But I don't know how to pass the filtered List to my main activity, to copy it, search in it and get the filtered list back to the adapter through the fragments.
u can use an interface for the same. an example of using an interface is shown in this video (ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-AkiltTv0CjA.html) that is on item click listener but u can use the same logic to implement an interface. hope that helps.
I have the movieList that you initialized as List moviesList I have a ModelClass, where I initailized as List moviesList How do I make it work the moviesListAll in the constructor??
I have problem in SearchView Basically I have EditText in my recycler view And whenever I search something it is showing successfully with each and every details But the value which I inserted in that EditText and search for something by SearchView then the value inserted for previous data will apply for the searched data For Ex: if I put the value in 2nd EditText and I search for 10th EditText the value which is in 2nd EditText will be in 10th EditText Please help me to solve this problem
hey from germany, i followed your instructions and the only problem is, when i clear the searchview, the unfiltered list is not shown. i wondering that your code works and my code not.
Hello, I did not have toolbar in my app earlier for some reasons. RecyclerView ia designed for 4th page after navigation and Now, for this recyclerview, I wanted to implement as search bar wont come. Please tell me how to implement it
Hello Sir ! Here is 1 thing that doesn't work for me: The list contains 4 innitial tasks, added from the onCreate method. I added the "Add" button, which adds new tasks from the keyboard. If I make a search, AFTER I add some new tasks: the search is returning the correct Strings, but after the "x" is clicked, the rendered list is the innitial 4 items lists. The tasks added from the keyboard are not saved. Would you please help ! Thank you !
Th aks Mittal, can u pls extend this with Synonyms, because of people are not good with English and are from Germany / France (my clients search beer / bear for 🍺
i am displaying pdf files in recycler view, i followed your code step-wise but still not getting the search results. could you please help me with this?
can you tell exactly on which line your getting this error, coz I ran this application again and I am not getting this error, please verify your code with the repo on GitHub.
Amigo buen dia. al escribir en el SearchView borra todo pero no muestra nada, y al borrar todo el contenido del SearchView deberia mostrar la lista completa pero no muestra nada
@@mafiacodes I have a list of users and their score. I sorted this by their score. There are total 2000+ users. Now what I want is that to show the position of current user. In simple word how to make the user to get his position in this list.(recyclerview)
Excuse me Sir. This does not works for me when I try to implement SearchView in Fragment. I mean, this works fine in MainActivity, but in Fragment does not. What could I do?
You can get the item itself but position is different since recycler view is renders again, but incase you want position then you can use a different approach like setting a tag as an id or something like that.
it is crashing when i touch the search bar with an error at Attempt to read from field 'java.lang.Object android.widget.Filter$FilterResults.values' on a null object reference typecasting error at :-------moviesList.addAll((Collection
please explain this in recyclerview item click listener please. last 7 days trying this but.this youtube no.not any videio this type. can't find any videio.please do this @Override public void onClick(View v) { final Intent intent; switch (getAdapterPostion()){ case 0: intent = new Intent(context, FirstActivity.class); break; case 1: intent = new Intent(context, SecondActivity.class); break; ... default: intent = new Intent(context, DefaultActivity.class); break; } context.startActivity(intent); }
I folowed the steps and i managed to filter just by the simple searchview . Its not reacting to andoidx version..cause it inflates the menu just with 3 dots of settings instead of search icon. And i didn't even set the "settings" item
i just copied the code and got this error; Getting this Error....please help me with this; java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.recyclerview.widget.RecyclerView.setAdapter(androidx.recyclerview.widget.RecyclerView$Adapter)' on a null object reference
Hi bro how r u , really your videos are lot of help me , make a one video for how to add search filter in nested recyclerview please make a video for this topic iam strucked here please Help me 🙏
@@learnandearn4847 I had to filter by the content not by the index because when I filter and click on the item it does not show me the correct item if I take the index
For those reading whom it crashes on them, don't forget that importing the correct library both in the xml and kt (or java) files is essential to get it to work, otherwise it'll crash.
I've found the solution, my searchview inside a fragment is working now. My solution was: 1. Don't inflate options menu in MainActivity 2. Inflate options menu in the fragment you want to perform the search 3. Put this line in fragment onCreate's: sethasoptionsmenu(true) Then you'll be able to handle searchview from fragment
sir i have another issue related to creating a pdf i am unable to get the file path for making new folder and generating pdf . getexternalstoragedirectory() method depericated so i want another one which is latest can you help me .