I want to implement search bar in my application which will filter list view depending on letters entered in edit text. Here is what I have actually like a design

So I want to filter the elements by title so I guess I have to change the sqlite statement, because I’m populating the listview from database.
And I have two question :
1.Which is the best way to implement custom search bar : add textwatcher to an edit text and change the sqlite statement everytime user enter letter or ?
2.How to sort in sqlite depending on letters entered from user. If user press A I want to show all items which have that letter no matter if it’s in the beginning or in the end.
So the things to achieve this are very simple, no matter what kind of
Adapterare you using. First you need to createTextWatcherand add it to yourEdit Text. Than in youronAfterTextChanged()you can create your new SQL statement like :Before getting your data again if you are using
ArrayListor any other kind ofListsfor storing your data you have to clear them, so you can get the new data. And than you can simply calladapter.notifySetDataChanged(). And it should work. At least this is the way how I’m doing this. Maybe it’s not the best way, but it’s working.