1. Are you ready for the Galaxy S20? Here is everything we know so far!

Android: Listadapter along with getfilter() for dynamic search filter?

Discussion in 'Android Development' started by AKA001, Feb 15, 2016.

  1. AKA001

    AKA001 Newbie
    Thread Starter

    I am having a list adapter:


    final Listadapter Adapter = new Listadapter(this,packageList1, packageManager);


    When trying to create dynamic search filter for the list items, I am unable to use list adapter along with get filter function. please refer below:




    final Listadapter Adapter = new Listadapter(this,packageList1, packageManager);

    apps.setAdapter(Adapter);



    //enables filtering for the contents of the given ListView



    SearchView sv = (SearchView) findViewById(R.id.inputSearch);

    sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

    @override

    public boolean onQueryTextSubmit(String text) {

    return false;

    }



    @override

    public boolean onQueryTextChange(String text) {



    Adapter.getFilter().filter(text);

    return false;

    }

    });


    During further search, I have seen that getfilter() works with Array adapter.

    Is there a way to use getfilter() functionality with ListAdapter?

    OR Use listAdapter as Array adapter in anyway?
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...
Similar Threads - Android Listadapter along
  1. Anirudha Deshpande
    Replies:
    0
    Views:
    48
  2. Sunny Rio
    Replies:
    9
    Views:
    321
  3. AntiMorrisey
    Replies:
    2
    Views:
    441
  4. Troubled Koentje
    Replies:
    20
    Views:
    664
  5. Alchemist Studio
    Replies:
    0
    Views:
    322
  6. mlgch1
    Replies:
    8
    Views:
    469
  7. zoezydk
    Replies:
    7
    Views:
    520
  8. ironass
    Replies:
    6
    Views:
    629
  9. ironass
    Replies:
    2
    Views:
    686
  10. ironass
    Replies:
    1
    Views:
    458

Share This Page

Loading...