Cursor setFilterQueryProvider issue

后端 未结 2 1961
伪装坚强ぢ
伪装坚强ぢ 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.

提交回复
热议问题