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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:34:59+00:00 2026-05-31T23:34:59+00:00

I’m trying to create a database with 12 different tables which has been working

  • 0

I’m trying to create a database with 12 different tables which has been working fine until today. Now every time I start my app for the first time after uninstalling it and re-installing it (or just clear app data) I get the error message seen in the title. However, the second time I start the app after getting this error it works fine.
The code bellow is from my DatabaseHelper class which is more or less the same as the android notepad tutorial.

This error comes after the database has been opened in my activity and I try to make my first query.

Any suggestions of what could cause this and how to solve it?

private static class DatabaseHelper extends SQLiteOpenHelper {

    private static String DB_PATH = "/data/data/my_app/databases/";

    DatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        if (!checkDataBase()) {
            db.execSQL(TABLE_1);
            db.execSQL(TABLE_2);
            db.execSQL(TABLE_3);

            db.execSQL(TABLE_4);
            db.execSQL(TABLE_5);
            db.execSQL(TABLE_6);

            db.execSQL(TABLE_7);
            db.execSQL(TABLE_8);
            db.execSQL(TABLE_9);

            db.execSQL(TABLE_10);
            db.execSQL(TABLE_11);
            db.execSQL(TABLE_12);
        }
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data");
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_1);
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_2);
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_3);

        db.execSQL("DROP TABLE IF EXISTS " + TABLE_4);
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_5);
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_6);

        db.execSQL("DROP TABLE IF EXISTS " + TABLE_7);
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_8);
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_9);

        db.execSQL("DROP TABLE IF EXISTS " + TABLE_10);
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_11);
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_12);
        onCreate(db);
    }

    private boolean checkDataBase() {
        SQLiteDatabase checkDB = null;
        try {
            checkDB = SQLiteDatabase.openDatabase(DB_PATH + DATABASE_NAME, null, SQLiteDatabase.OPEN_READONLY);
            checkDB.close();
        } catch (SQLiteException e) {

        }
        return checkDB != null ? true : false;
    }
}
  • 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-31T23:35:01+00:00Added an answer on May 31, 2026 at 11:35 pm

    The problem is that your database probably doesn’t include Android-related metadata.

    You need to use the SQLiteDatabase.NO_LOCALIZED_COLLATORS flag when calling SQLiteDatabase.openDatabase() – this no longer causes the problem. At least it worked for me.

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,

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.