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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:36:36+00:00 2026-06-01T17:36:36+00:00

I am trying to run a class that will check for information in a

  • 0

I am trying to run a class that will check for information in a data base then display it on the screen. it was working yesterday untill i added in code for it to check information in a second table i will post both the code and the logcat as i dont know why this is happening

public class WorkoutProgress extends ListActivity {

  private DataBaseHelper datasource;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    /*requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);*/
    super.onCreate(savedInstanceState);
    setContentView(R.layout.progress);

    datasource = new DataBaseHelper(this);
    datasource.open();
    fillData();
    datasource.close();
  }
  private void fillData() {
    // Get all of the notes from the database and create the item list
    Cursor c = datasource.getAllTitles();
    startManagingCursor(c);

    String[] from = new String[] {DataBaseHelper.KEY_CODE,  DataBaseHelper.KEY_DAYS,DataBaseHelper.KEY_BMI };
    int[] to = { R.id.code, R.id.Days, R.id.BMI };
    String[] from2 = new String[] {DataBaseHelper.KEY_DATE,  DataBaseHelper.KEY_STEPS,DataBaseHelper.KEY_CALs };
    int[] to2 = { R.id.date, R.id.steps, R.id.cals };
    // Now create an array adapter and set it to display using our row
    SimpleCursorAdapter notes =
     new SimpleCursorAdapter(this, R.layout.notes_row, c, from, to);
    setListAdapter(notes);
    SimpleCursorAdapter notes2 =
      new SimpleCursorAdapter(this, R.layout.notes_row, c, from2, to2);
    setListAdapter(notes);
  }

  public void add(View view) {
    //Do nothing
  }

  public void delete(View view) {
     datasource.open();
     datasource.deleteFirst();
     fillData();
     datasource.close();
  }
}

and the log cat when i try to access this class is

04-06 01:10:42.293: E/global(22219): java.lang.UnsupportedOperationException
04-06 01:10:42.293: E/global(22219):    at java.lang.VMThread.stop(VMThread.java:85)
04-06 01:10:42.293: E/global(22219):    at java.lang.Thread.stop(Thread.java:1391)
04-06 01:10:42.293: E/global(22219):    at java.lang.Thread.stop(Thread.java:1356)
04-06 01:10:42.293: E/global(22219):    at com.b00348312.workout.Splashscreen$1.run(Splashscreen.java:42)
04-06 01:10:45.393: I/Database(22219): sqlite returned: error code = 1, msg = AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY
04-06 01:10:45.393: E/Database(22219): Failure 1 (AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY) on 0x2c0e38 when preparing 'create table goals (_id primary key autoincrement, code text not null,days title text not null, bmi text not null);'.
04-06 01:10:45.403: D/AndroidRuntime(22219): Shutting down VM
04-06 01:10:45.403: W/dalvikvm(22219): threadid=1: thread exiting with uncaught exception (group=0x400259f8)
04-06 01:10:45.453: D/dalvikvm(22219): GC_FOR_MALLOC freed 4012 objects / 253248 bytes in 32ms
04-06 01:10:45.453: E/AndroidRuntime(22219): FATAL EXCEPTION: main
04-06 01:10:45.453: E/AndroidRuntime(22219): java.lang.RuntimeException: Unable to start  activity ComponentInfo{com.b00348312.workout/com.b00348312.workout.WorkoutProgress}: android.database.sqlite.SQLiteException: AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY: create table goals (_id primary key autoincrement, code text not null,days title text not null, bmi text not null);
04-06 01:10:45.453: E/AndroidRuntime(22219):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2787)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at android.app.ActivityThread.access$2300(ActivityThread.java:135)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at android.os.Looper.loop(Looper.java:144)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at android.app.ActivityThread.main(ActivityThread.java:4937)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at java.lang.reflect.Method.invokeNative(Native Method)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at java.lang.reflect.Method.invoke(Method.java:521)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at dalvik.system.NativeStart.main(Native Method)
04-06 01:10:45.453: E/AndroidRuntime(22219): Caused by: android.database.sqlite.SQLiteException: AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY: create table goals (_id primary key autoincrement, code text not null,days title text not null, bmi text not null);
04-06 01:10:45.453: E/AndroidRuntime(22219):    at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1817)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at com.b00348312.workout.DataBaseHelper$DatabaseHelper.onCreate(DataBaseHelper.java:59)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:106)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at com.b00348312.workout.DataBaseHelper.open(DataBaseHelper.java:78)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at com.b00348312.workout.WorkoutProgress.onCreate(WorkoutProgress.java:21)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069)
04-06 01:10:45.453: E/AndroidRuntime(22219):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
04-06 01:10:45.453: E/AndroidRuntime(22219):    ... 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-06-01T17:36:38+00:00Added an answer on June 1, 2026 at 5:36 pm

    The stack trace says:

    Failure 1 (AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY) on
    0x2c0e38 when preparing ‘create table goals (_id primary key
    autoincrement, code text not null,days title text not null, bmi text
    not null);’.

    It looks like you forgot to declare the _id field as an INTEGER in your create table statement.

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

Sidebar

Related Questions

I'm trying to build a search engine that will check a list and then
I am trying to run a function of the main class, but even with
I am trying to run the following simple code, public abstract class Shape{ abstract
I am trying to compile and run a simple java class within eclipse. The
I'm trying to write a small Windows Service in .NET 3.5, that check every
I'm new to C++ and trying to implement a turtle emulator that will read
I am trying to create a SQL statement that will allow me to remove
I am trying to create a class that allows search of a database to
I have a DBAdmin class that connects to the database, and then some other
I'm refactoring, and have run into a roadblock. Background: I have a base class

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.