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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:09:15+00:00 2026-06-18T08:09:15+00:00

I was reading this thread: What is the use of BaseColumns in Android ,

  • 0

I was reading this thread: What is the use of BaseColumns in Android, and I get how to use BaseColumns, that you have to fetch _id in your SELECT statements.

What’s still unclear to me is when is the _id field “internally” created? Is it during execSQL(…) that Android adds the _id field? Or, do we still have to define it in the CREATE TABLE statement?

  • 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-18T08:09:16+00:00Added an answer on June 18, 2026 at 8:09 am

    You must create it “manually”. Android won’t do that for you.

    For example, during table creation, you issue:

    CREATE TABLE messages (_id INTEGER PRIMARY KEY AUTOINCREMENT, timestamp INTEGER, message TEXT);
    

    See? The _id column is explicitly named and added.

    Or, following the convention of DB-helper classes you’ll come up with something like that:

    db.execSQL("CREATE TABLE " + TABLE_MESSAGES + " ("
            + BaseColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
            + COLUMN_TIMESTAMP + " INTEGER,"
            + COLUMN_MESSAGE + " TEXT"
            + ");");
    

    where the TABLE_* and COLUMN_* are constant fields of DB-helper, e.g.:

    public static final String TABLE_MESSAGES = "messages";
    public static final String COLUMN_TIMESTAMP = "timestamp";
    public static final String COLUMN_MESSAGE = "message";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Reading this article http://support.microsoft.com/kb/813878 I have a question: Where can I get ipseccmd.exe for
I was just reading this thread and it occurred to me that there is
I've been reading and trying to use the method proposed in this thread: How
I was reading through this thread: Hidden Features of JavaScript? and found this post:
While reading this class BitmapFactory I noticed that almost all methods inside are static.
After reading this article I don't have a clear answer: http://palizine.plynt.com/issues/2010Oct/bypass-xss-filters/ Will browsers interpret
After reading this article on thedailywtf.com, I'm not sure that I really got the
After reading this thread: NSUserDefaults not present on first run on simulator I know
I was reading this: http://en.wikipedia.org/wiki/Thread_safety Is the following function thread-safe? void foo(int y){ int
I was recently reading this thread , on some of the worst PHP practices.

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.