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 8103957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:41:55+00:00 2026-06-05T23:41:55+00:00

This is the error i’m getting when i try to run my application Illegal

  • 0

This is the error i’m getting when i try to run my application

Illegal argument exception in android : Column _id doesn’t exist

   public static final String OBJ_ID="_id";

and the creation of database is as follows:

 private static final String CREATE_TAB1= "create table " + TABLE_1 + " (" + OBJ_ID + " integer primary key                                     
    autoincrement, " + OBJ_NAME + " text not null, " + DESC1 + " text not null, " + DESC2 + " text not null);"; 

Trying to retrieve the data by using the following function in databasehandler:

     public Cursor getAllTable1() {
                return db.query(TABLE_1, 
                                new String[] { OBJ_NAME }, 
                                null, null, null, null, null);
              }

This is the function where i communicate with databse

    public class List_View extends ListActivity {



public void onCreate(Bundle icicle)
{
    super.onCreate(icicle); 
    setContentView(R.layout.displayitems); 

     Databasehelp db = new Databasehelp(this);
    db.open();


    Cursor cursor = db.getAllTable1();

     startManagingCursor(cursor); 

    SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, 
           R.layout.list_example_entry, cursor, 
           new String[] {"name"}, 
           new int[] {R.id.name_entry }); 
    setListAdapter(adapter);
}
}

Although my database schema consist of column named _id. I changed this to even _ID but didn’t seem to work . Can anyone pls help me in resolving this?

  • 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-05T23:41:57+00:00Added an answer on June 5, 2026 at 11:41 pm

    You must select the column _id when binding a Cursor to ListView (Spinner, etc).

    So add the _id column like this:

    public Cursor getAllTable1() {
        return db.query(TABLE_1, 
                new String[] { OBJ_ID, OBJ_NAME }, 
                null, null, null, null, null);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting this error when try to add an item to my repositories/context: Collection has
this error occurred what to do run the application?? Initializing AppEngine server 25/06/2010 9:16:57
Getting this error: Each GROUP BY expression must contain at least one column that
Getting this error on chrome while trying to make cross-domain requests with GWT application.
I keep getting this error after my application is running for 2 days. I've
this error arises when i try to run the following test case which is
Getting this error: java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:200) at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
this error is always fired, when i'm try to free my allocated struct the
Getting this error when I follow the simple code example from jsoncpp, that basically
Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler

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.