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

  • SEARCH
  • Home
  • 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 4584870
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:24:55+00:00 2026-05-21T21:24:55+00:00

My app is required to return a cursor containing a bunch of quotes, depending

  • 0

My app is required to return a cursor containing a bunch of quotes, depending on the author chosen. Right now, I am hard coding the application so it will return only one author’s quotes.

The error is occurring in my cursor adapter parameters, setting the “to” column, it tells me that this column, “quote”, does not exist.

I have tried changing the to parameter to KEY_QUOTE, and even tried changing the name of the actual database column but still now joy.

What am I doing wrong?

Below are the blocks of code used in this operation.

  1. Creating the database table, Quotes
  2. Populating this table
  3. Querying for the quotes
  4. Opening the database connection, cursor creation(where I am getting the actual error, with the “from” parameter)

1.

private static final String CREATE_QUOTE_TABLE = 

            "create table " + QUOTES_TABLE +
            " (_id integer primary key autoincrement, " + 
            "auth_name text not null, " +
            "myQuote text not null, " +
            "category text not null);";

2.

public long populateQuotes(){

    ContentValues initialValues = new ContentValues();

    long[] rowIds = new long[authorName.length];

    // Add wilson quotes category: Anthropology
    for(int i = 0; i < 3; i++){
        initialValues.put(KEY_AUTHNAME, authorName[3]);
        initialValues.put(KEY_QUOTE, quoteRAW[i]);
        initialValues.put(KEY_CATEGORY, category[0]);
        rowIds[i] = qmDB.insertOrThrow(QUOTES_TABLE, null, initialValues);
    }
    // Add wilson quotes category: RAW
    for(int i = 3; i < 5; i++){
        initialValues.put(KEY_AUTHNAME, authorName[3]);
        initialValues.put(KEY_QUOTE, quoteRAW[i]);
        initialValues.put(KEY_CATEGORY, category[1]);
        rowIds[i] = qmDB.insertOrThrow(QUOTES_TABLE, null, initialValues);

    }
    // Add wilson quotes category: Philosophy
    for(int i = 5; i < 11; i++){
        initialValues.put(KEY_AUTHNAME, authorName[3]);
        initialValues.put(KEY_QUOTE, quoteRAW[i]);
        initialValues.put(KEY_CATEGORY, category[2]);
        rowIds[i] = qmDB.insertOrThrow(QUOTES_TABLE, null, initialValues);

    }
    // Add wilson quotes category: General Semantics
    for(int i = 11; i < 12; i++){
        initialValues.put(KEY_AUTHNAME, authorName[3]);
        initialValues.put(KEY_QUOTE, quoteRAW[i]);
        initialValues.put(KEY_CATEGORY, category[3]);
        rowIds[i] = qmDB.insertOrThrow(QUOTES_TABLE, null, initialValues);

    }
    // Add wilson quotes category: Humor
    for(int i = 11; i < 12; i++){
        initialValues.put(KEY_AUTHNAME, authorName[3]);
        initialValues.put(KEY_QUOTE, quoteRAW[i]);
        initialValues.put(KEY_CATEGORY, category[4]);
        rowIds[i] = qmDB.insertOrThrow(QUOTES_TABLE, null, initialValues);

    }

    return rowIds[0];
}

3.

public Cursor getQuotes(){

    /*
    return qmDB.query(QUOTES_TABLE, new String[]{
            KEY_QUOTE
            },
            KEY_AUTHNAME + "=" + "'Robert Anton Wilson'",
            null,
            null,
            null,
            null);*/



    //String who = authorName[position];
    return qmDB.rawQuery("SELECT _id as _id from Quotes WHERE auth_name = ?",
            new String[]{"'Robert Anton Wilson'"});

}

4.

// Create DB connection and open.
    dbm = new MyDBManager(this);
    dbm.open();

    // Call for the quotes to be queried, store results in cursor.
    myCursor = dbm.getQuotes();
    myCursor.moveToFirst();

    // Column quote does not exist?
    SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, R.layout.quoterow,                myCursor, new String[]{"myQuote"}, new int[]{R.id.quote});
    this.setListAdapter(mAdapter);

    myCursor.close();

For further clarification I have included the error log:

05-01 18:38:13.876: ERROR/AndroidRuntime(1455): FATAL EXCEPTION: main
05-01 18:38:13.876: ERROR/AndroidRuntime(1455): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.QuoteMachine/com.QuoteMachine.Quote}: java.lang.IllegalArgumentException: column 'myQuote' does not exist
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2787)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at android.app.ActivityThread.access$2300(ActivityThread.java:135)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at android.os.Looper.loop(Looper.java:144)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at android.app.ActivityThread.main(ActivityThread.java:4937)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at java.lang.reflect.Method.invokeNative(Native Method)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at java.lang.reflect.Method.invoke(Method.java:521)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at dalvik.system.NativeStart.main(Native Method)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455): Caused by: java.lang.IllegalArgumentException: column 'myQuote' does not exist
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:314)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at android.widget.SimpleCursorAdapter.findColumns(SimpleCursorAdapter.java:312)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at android.widget.SimpleCursorAdapter.<init>(SimpleCursorAdapter.java:87)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at com.QuoteMachine.Quote.onCreate(Quote.java:42)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
05-01 18:38:13.876: ERROR/AndroidRuntime(1455):     ... 11 more
  • 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-05-21T21:24:56+00:00Added an answer on May 21, 2026 at 9:24 pm

    In CREATE_QUOTE_TABLE you use “quote text not null, “, and in the logcat you show: Caused by: java.lang.IllegalArgumentException: column 'myQuote' does not exist. What’s the value of KEY_QUOTE? It should match the column name in the table.

    Test this query:

    return qmDB.rawQuery("SELECT _id, myQuote, auth_name, category FROM Quotes WHERE auth_name=?", 
        new String[]{"'Robert Anton Wilson'"});
    

    I believe your problem was not that the query tried to retrieve a column that was not there. The problem I believe is that the cursor you created does not have all the information needed by your adapter (i.e., it’s the cursor that does not have the column, not the table).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My Rails app has some pages which are SSL-required and others which are SSL-optional.
I am developing one app , which is required to integrate Google checkout.I am
I started deploying my latest RoR app on Heroku , which required me to
I'm very new to Java which is required for a Blackberry App development project
I've recently begun working on Django and now my app is nearing completion and
I am working on a simple app engine application that utilize the geo-searching proximity_fetch.
I'm implementing home brew ACL system in web app and it gives me hard
I'm moving an app to use only Google Federated Login (OpenID) for an application
Why is a return statement required to allow this while statement to be evaluated
I've set required permissions for my app in Settings/Auth dialog. However they doesn't show

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.