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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:14:07+00:00 2026-05-17T17:14:07+00:00

Im having some troubles trying to get the info stored in my database and

  • 0

Im having some troubles trying to get the info stored in my database and showing it in a ListView.

This is the ListActivity where i want to show the rows:

public class Prueba extends ListActivity{

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.i_prueba);

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

        Cursor result = db.getAllContact();
        startManagingCursor(result);


        // the desired columns to be bound
        String[] columns = new String[] {"_id", "nombre", "telefono", "mail"};
        // the XML defined views which the data will be bound to
        int[] to = new int[] { R.id.textid, R.id.textNombre, R.id.textTelefono, R.id.textMail };

        SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, R.layout.i_listadb, result, columns, to);


        this.setListAdapter(mAdapter);

    }

The DB class. Here is the method getAllContact where i get the error:

public class DataBaseAccess {

public static final String NOMBRE = "nombre";
public static final String TELEFONO = "telefono";
public static final String MAIL = "mail";
public static final String ID = "_id";


    public DataBaseAccess(Context context) {
        this.androidContext = context;
//DataBaseHelper is another class where the Database is created. In the "onCreate" //method of that class is where i make the CREATE TABLE and add some values to that //table.
        dbHelper = new DataBaseHelper(androidContext);  
    }



    public void open() throws SQLException {
        db = dbHelper.getWritableDatabase();
        }



[...MORE METHODS...]

    public Cursor getAllContact(){
        String[] columnas = new String[] {ID, NOMBRE, TELEFONO, MAIL};
        Cursor mCursor = dbHelper.query("t_contactos", columnas, null, null, null, null, null);
    if (mCursor != null){
        mCursor.moveToFirst();
    }
    return mCursor;
}

}

And here is the error messages from the LogCat:

E/AndroidRuntime(  636): Uncaught handler: thread main exiting due to uncaught exception

E/AndroidRuntime(  636): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pfc.android/com.pfc.android.Prueba}: android.database.sqlite.SQLiteException: no such column: _id: , while compiling: SELECT _id, nombre, telefono, mail FROM t_contactos

E/AndroidRuntime(  636):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)

E/AndroidRuntime(  636):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)

E/AndroidRuntime(  636):    at android.app.ActivityThread.access$2100(ActivityThread.java:116)

E/AndroidRuntime(  636):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)

E/AndroidRuntime(  636):    at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime(  636):    at android.os.Looper.loop(Looper.java:123)

E/AndroidRuntime(  636):    at android.app.ActivityThread.main(ActivityThread.java:4203)

E/AndroidRuntime(  636):    at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(  636):    at java.lang.reflect.Method.invoke(Method.java:521)

E/AndroidRuntime(  636):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)

E/AndroidRuntime(  636):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)

E/AndroidRuntime(  636):    at dalvik.system.NativeStart.main(Native Method)

E/AndroidRuntime(  636): Caused by: android.database.sqlite.SQLiteException: no such column: _id: , while compiling: SELECT _id, nombre, telefono, mail FROM t_contactos

E/AndroidRuntime(  636):    at android.database.sqlite.SQLiteProgram.native_compile(Native Method)

E/AndroidRuntime(  636):    at android.database.sqlite.SQLiteProgram.compile(SQLiteProgram.java:110)

E/AndroidRuntime(  636):    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:59)

E/AndroidRuntime(  636):    at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:49)

E/AndroidRuntime(  636):    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:49)

E/AndroidRuntime(  636):    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1118)

E/AndroidRuntime(  636):    at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1006)

E/AndroidRuntime(  636):    at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:964)

E/AndroidRuntime(  636):    at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1041)

E/AndroidRuntime(  636):    at com.pfc.android.DataBaseAccess.getAllContact(DataBaseAccess.java:97)

E/AndroidRuntime(  636):    at com.pfc.android.Prueba.onCreate(Prueba.java:21)

E/AndroidRuntime(  636):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)

E/AndroidRuntime(  636):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)

E/AndroidRuntime(  636):    ... 11 more

So, can anybody help to get through this?
Thank you in advance !

  • 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-17T17:14:08+00:00Added an answer on May 17, 2026 at 5:14 pm

    You probably don’t have a column _id in your database table. Pull the database and open it with SqliteViewer to check if it actually exists. The database is usually under /data/data/com.yourapp.package/databases/

    You can use:
    http://sqlitebrowser.sourceforge.net/
    or
    http://www.navicat.com/en/products/navicat_sqlite/sqlite_overview.html (they also have a free lite version)

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

Sidebar

Related Questions

i'm having some trouble in making this on right. I'm trying to get the
I am having some troubles trying to get a route to work so far
I'm trying to get started using git, but I'm having some troubles right away.
I'm trying to move some Excel-Data to MySQL, but having troubles with encoding. What
So I'm trying to scrap some car info off of Gasbuddy.com, but I'm having
I'm having some trouble trying to get my tweets on the header of my
I am having some trouble trying to get a report to print from a
I'm having some trouble with this code. I am trying to write a function
having some trouble trying to figure this out, complete novice when it come to
I am having some trouble trying to figure this out. What i have is

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.