jeudi 5 mai 2016

SQLite SearchView not filtering data properly

Hello Android developers. I am new at Java programming and I faced an issue. I have made a program with SQLite database. It is simple program with add and delete features. Now I want to add search/filter feature and I think about using searchView. I followed tutorial and used this code inside setOnQueryTextListener:

searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextSubmit(String text) {
                return false;
            }

            @Override
            public boolean onQueryTextChange(String text) {
                adapter.getFilter().filter(text);
                return false;
            }
        });

But when I used this code, it filtered elements, but after searching with this method once, I cannot Add any more items to database or delete them from it. I have a listView with names only. Maybe someone knows how to fix this code? Maybe I have to use other code? I need it working... Thanks a lot for your answers!

Aucun commentaire:

Enregistrer un commentaire