Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9238043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:40:05+00:00 2026-06-18T07:40:05+00:00

I’m trying to filter the results of a cursor returned from my database Handler

  • 0

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 the moment I’m getting multiple errors on the following method:

Current errors:

Error 1:

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

Error 2:

Syntax error, insert ";" to complete Statement.

Error 3:

Illegal modifier for the variable runQuery; only final is permitted

Error 4:

Syntax error on token ")", ; expected

Error 5:

Void methods cannot return a value.

Error 6:

Syntax error on token ")", delete this token.

The above errors are noted on the following code:

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

             //ERROR 1 on 'FilterQueryProvider' and ERROR 2 on end ')'.
     cursorAdapter.setFilterQueryProvider(FilterQueryProvider()

            {

            //ERROR 3 on 'runQuery'. Error 4 on end ')'.
        public Cursor runQuery(CharSequence constraint)
        {
                //ERROR 5.
            return changedAppoint.getChanges(constraint.toString());

        }
        ERROR 6 on end ')'
    });

Here is the completed class. I currently have this problematic method in my ‘onCreate’ method of the class. The fact ‘ERROR 5’ is complaining about the return type leads me to believe this being in ‘OnCreate’ is the wrong place as obviously it is void. Placing it else where in the code produces other brackets errors.

Hopefully someone can see where my layout error is going wrong.

package com.example.flybase2;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.ListActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.widget.SimpleCursorAdapter;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ListView;

public class ViewAppointments extends ListActivity implements OnClickListener {
SimpleCursorAdapter cursorAdapter;
ListView searchedAppView;
ImageButton searchAppoints;
EditText searchAppName;
Long id;

 //@SuppressWarnings("deprecation")
 //@SuppressWarnings("static-access")


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


setContentView(R.layout.appointmentview);

searchedAppView = (ListView)findViewById(android.R.id.list);

searchAppoints = (ImageButton) findViewById(R.id.btnSearchAppointName); 
searchAppName = (EditText) findViewById(R.id.inputAppointName); 

    DBHandlerApp DBAppointments = new DBHandlerApp(this, null, null);

    DBHandlerApp searchApps = new DBHandlerApp(this, null, null);

    searchApps.open();


    Cursor cursor = searchApps.getAppointmentsData();
     searchApps.close();
    startManagingCursor(cursor);


    String [] from = new String [] {DBAppointments.KEY_NAMEAPP, DBAppointments.KEY_TYPEAPP, DBAppointments.KEY_TIMEAPP, DBAppointments.KEY_DATEAPP, DBAppointments.KEY_COMMENTAPP};
    int [] to = new int [] {R.id.txtAppointName, R.id.txtAppointType, R.id.txtAppointTime, R.id.txtAppointDate, R.id.txtAppointCom};


    cursorAdapter = new SimpleCursorAdapter(this, R.layout.setappointviews, cursor, from, to);
    searchedAppView.setAdapter(cursorAdapter);

    searchedAppView.setTextFilterEnabled(true);

    searchAppoints.setOnClickListener(this);

    searchAppName.addTextChangedListener(new TextWatcher()
     {

        @Override
        public void onTextChanged(CharSequence s, int start, int before,
                int count) {


        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count,
                int after) {


        }

        @Override
        public void afterTextChanged(Editable s) {



                cursorAdapter.getFilter().filter(s.toString());

        }

     });

            //********** ERRORS **********
    DBHandlerApp changedAppoint = new DBHandlerApp (this, null, null);

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

        }
    });


    };


@Override
public void onClick(View clickedSearch)

{

    String searchedName = searchAppName.getText().toString();

    DBHandlerApp searchOnName = new DBHandlerApp(this, null, null);
    DBHandlerApp getColumns = new DBHandlerApp(this, null, null);
    searchOnName.open();

    Cursor nameResult = searchOnName.searchAppByName(searchedName);

    @SuppressWarnings("static-access")
    String [] from = new String [] {getColumns.KEY_NAMEAPP, getColumns.KEY_TYPEAPP, getColumns.KEY_TIMEAPP, getColumns.KEY_DATEAPP, getColumns.KEY_COMMENTAPP};
    int [] to = new int [] {R.id.txtAppointName, R.id.txtAppointType, R.id.txtAppointTime, R.id.txtAppointDate, R.id.txtAppointCom};

    @SuppressWarnings("deprecation")

    SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(this, R.layout.setappointviews, nameResult, from, to);
    searchedAppView.setAdapter(cursorAdapter);

}

@Override
protected void onListItemClick(ListView l, View v, int position, long idd) {
    super.onListItemClick(l, v, position, idd);
    final DBHandlerApp delApp = new DBHandlerApp(this, null, null);

    id = idd;

    final CharSequence[] items = {"Edit Appointment Details", "Delete Appointment"};

    Builder alertDialogBuilder = new AlertDialog.Builder(ViewAppointments.this);

    alertDialogBuilder.setTitle("Appointment Options:");



    alertDialogBuilder.setItems(items, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int item) {

            if (items[item].equals("Edit Appointment Details")) {

                Intent setName = new Intent("com.example.flybase2.AppointmentEditChanges");
                setName.putExtra("passedID", id);
                startActivity(setName);

            }

            else if (items[item].equals("Delete Appointment")) {

                      delApp.open();
                      delApp.deleteAppointment(id);
                      delApp.close();

            }

            }  

        });

    alertDialogBuilder.show();
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:40:05+00:00Added an answer on June 18, 2026 at 7:40 am

    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
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I am doing a simple coin flipping experiment for class that involves flipping a
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have a view passing on information from a database: def serve_article(request, id): served_article
I am trying to loop through a bunch of documents I have to put
Let's say I'm outputting a post title and in our database, it's Hello Y’all
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.