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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:20:17+00:00 2026-06-18T00:20:17+00:00

Am trying to add some values from a list to the android sqlite database

  • 0

Am trying to add some values from a list to the android sqlite database but somehow it doesnt seem to find the table, and also the things i try to add in the table are not in the correct order according to logcat. I used 3 more tables and i added values into those with no problem. Ive been struggling on this for a while but i cant seem to see the problem. Any ideas? Here is my code and error message:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    currentCurrency = new ArrayList<String>();
    currentCurrencyDetails = new ArrayList<String>();
    currentCurrency.add("€");
    currentCurrencyDetails.add("€ EURO");
    currentCurrency.add("£");
    currentCurrencyDetails.add("£ UK POUND");
    currentCurrency.add("$");
    currentCurrencyDetails.add("$ USA DOLLAR");
    currentCurrency.add("¥");
    currentCurrencyDetails.add("¥ JAPAN YEN");

    db = new DBAdapter(this);
    db.open();
    for (int i = 0; i <= currentCurrency.size() - 1; i++) {
        if (i == 0) {
            db.insertDefaultCurrency(currentCurrency.get(i).toString(),
                    currentCurrencyDetails.get(i).toString(), 1);
        } else {
            db.insertDefaultCurrency(currentCurrency.get(i).toString(),
                    currentCurrencyDetails.get(i).toString(), 0);
        }
    }

}

DBAdapter class:

public static final String MY_CURRENT_CURRENCY_TABLE = "MyCurrency";
public static final String MY_CURRENT_CURRENCY = "MyCurrentCurrency";
public static final String MY_CURRENT_CURRENCY_NAMES = "MyCurrentCurrencyNames";
public static final String MY_CURRENT_CURRENCY_BOOLEAN = "MyCurrentCurrencyBoolean";

private static final String DATABASE4_CREATE = "CREATE TABLE "
        + MY_CURRENT_CURRENCY_TABLE + "(" + MY_CURRENT_CURRENCY + " TEXT NOT NULL, "
        + MY_CURRENT_CURRENCY_NAMES + " TEXT NOT NULL, "
        + MY_CURRENT_CURRENCY_BOOLEAN + "INTEGER NOT NULL);";

    public void onCreate(SQLiteDatabase db) {
        db.execSQL(DATABASE_CREATE);
        db.execSQL(DATABASE1_CREATE);
        db.execSQL(DATABASE2_CREATE);
        db.execSQL(DATABASE3_CREATE);
        db.execSQL(DATABASE4_CREATE);
    }

public long insertDefaultCurrency(String currency, String currencyDetails, int usedBoolean) {
    ContentValues initialValues = new ContentValues();
    initialValues.put(MY_CURRENT_CURRENCY, currency);
    initialValues.put(MY_CURRENT_CURRENCY_NAMES, currencyDetails);
    initialValues.put(MY_CURRENT_CURRENCY_BOOLEAN, usedBoolean);
    return db.insert(MY_CURRENT_CURRENCY_TABLE, null, initialValues);
}

logcat message:

01-28 10:31:26.865: E/SQLiteLog(8623): (1) table MyCurrency has no column named MyCurrentCurrencyBoolean
01-28 10:31:26.880: E/SQLiteDatabase(8623): Error inserting MyCurrentCurrencyBoolean=1 MyCurrentCurrency=€ MyCurrentCurrencyNames=€ EURO
01-28 10:31:26.880: E/SQLiteDatabase(8623): android.database.sqlite.SQLiteException: table MyCurrency has no column named MyCurrentCurrencyBoolean (code 1): , while compiling: INSERT INTO MyCurrency(MyCurrentCurrencyBoolean,MyCurrentCurrency,MyCurrentCurrencyNames) VALUES (?,?,?)
  • 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-18T00:20:18+00:00Added an answer on June 18, 2026 at 12:20 am

    Change:

    + MY_CURRENT_CURRENCY_BOOLEAN + "INTEGER NOT NULL);";
    

    to

    + MY_CURRENT_CURRENCY_BOOLEAN + " INTEGER NOT NULL);";
    

    The missing space between " and INTEGER is almost definitely the cause of your error. After that, clear your app’s data and run it again so that the database is recreated.

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

Sidebar

Related Questions

I am trying to get some values from a List and then create a
I'm trying to add the items from a list to some rows in an
I'm trying to put into form ( select ) some values from database: val
I'm trying to insert values on Android SQLite Database. The question is, I'm trying
I am trying to add some logic in this. But I am not sure
I'm trying to populate a list view from a SQLite db I can create
I'm trying to add some client-side list grouping functionality into my Rails app. It's
I'm trying to sieve out some common tag-combinations from a list of educational question
We're trying to find out some performance fixes reading from a TADOQuery. Currently, we
i'm trying to coding an android app that send some post values to a

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.