Cursor setFilterQueryProvider issue

后端 未结 2 1960
伪装坚强ぢ
伪装坚强ぢ 2021-01-24 04:41

I\'m trying to filter the results of a cursor returned from my database Handler class through the use of the \'setFilterQueryProvider\' on the simple cursor adapter class. At th

相关标签:
2条回答
  • 2021-01-24 04:44

    The method FilterQueryProvider() is undefined for the type ViewAppointments.

    The error is pretty self explanatory, instead of providing an instance of FilterQueryProvider to the setFilterQueryProvider() method you call a FilterQueryProvider() method which will mess things up. Instead it should be like this:

    cursorAdapter.setFilterQueryProvider(new FilterQueryProvider() {
    
        public Cursor runQuery(CharSequence constraint) {
            return changedAppoint.getChanges(constraint.toString());
        }
    });
    

    And make changedAppoint final :

    final DBHandlerApp changedAppoint = new DBHandlerApp (this, null, null);
    

    See if you have any errors after the changes above.

    0 讨论(0)
  • 2021-01-24 05:05

    I managed to fix this issue. It was due to a number of issues but the biggest one was the fact I had not imported the 'filterQueryProvider' widget!

    0 讨论(0)
提交回复
热议问题