Search code examples
androidandroid-studioandroid-recyclerviewandroid-volleysearchview

how to add Search functionality in android recyclerView using Volley library


I am making android application in which I am doing search within RecyclerView Items. request is going to server successfully. Basically I am making search with keyword. The problem is how i can send search keyword to server and load data according to that keyword. here is my search activty:


Solution

  • Call getData() method in onTextChanged() and get string from search bar as

    searchItem = s.toString();

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int 
            count) {
            Log.d("onTextChanged", getClass().getSimpleName() + " text 
            changed " + searchBar.getText());
            searchItem = s.toString();
            Log.d("Text",searchItem);
            getData();
        }