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

  • Home
  • SEARCH
  • 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 9206341
In Process

The Archive Base Latest Questions

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

can someone help in SQLite database in android ? First all,i have using tutorial

  • 0

can someone help in SQLite database in android?

First all,i have using tutorial from here. It works well in my application but when i added new column and change database version to ‘2’, the application stopped and in the file explorer, no database found.could anyone state whats the problem is and the solution.

edited:
here is some my changes..
this is my FirstClass.java

// Database creation SQL statement
  private static final String DATABASE_CREATE = "create table " 
      + TABLE_TODO
      + "(" 
      + COLUMN_ID + " integer primary key autoincrement, " 
      + COLUMN_CATEGORY + " text not null, " 
      + COLUMN_SUMMARY + " text not null," 
      + COLUMN_DESCRIPTION
      + " text not null" 
      + COLUMN_DATE + "date not null " //i have added the date column
      + ");";
     public static void onCreate(SQLiteDatabase database) {
    database.execSQL(DATABASE_CREATE);

  }

  public static void onUpgrade(SQLiteDatabase database, int oldVersion,
      int newVersion) {
    Log.w(FirstClass.class.getName(), "Upgrading database from version "
        + oldVersion + " to " + newVersion
        + ", which will destroy all old data");
    database.execSQL("DROP TABLE IF EXISTS " + TABLE_TODO);
   // database.execSQL("INSERT INTO "+TABLE_TODO+" VALUES (null, datetime()) ");
    onCreate(database);
  }

and here is my TodoDatabaseHelper.java

private static final String DATABASE_NAME = "todotable2.db";
  private static final int DATABASE_VERSION = 2;

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

  // Method is called during creation of the database
  @Override
  public void onCreate(SQLiteDatabase database) {
    FirstClass.onCreate(database);
  }

  // Method is called during an upgrade of the database,
  // e.g. if you increase the database version
  @Override
  public void onUpgrade(SQLiteDatabase database, int oldVersion,
      int newVersion) {
    FirstClass.onUpgrade(database, oldVersion, newVersion);
  }
  • 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:09:19+00:00Added an answer on June 18, 2026 at 12:09 am

    using onUpgrade() you just remove table structure not entire database.

    Solution:

    (1) Remove your application pro grammatically when you update database.

    (2) you have to uninstall your application in your mobile and reinstall.

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

Sidebar

Related Questions

I have 2 tables in my sqlite3 database. Can someone help me with the
Can someone help me achieve multiple zend pagination in a view using ajax. I
Can someone help by showing me how to sort a LINQ expression. I have
Hoping someone can help a new iOS developer out - I have a ready
Can someone help me with getting values from a dropdownlist in asp.net mvc? I
Can someone help me explain what is happening here? Sorry if this is a
Can someone help me get the value of the columndefinition/column/cssclass from within my rows
I have an application that uses a SQLite database and everything works the way
Again, I need someone's help. I am following the below tutorial for SQLite connection
I want to retrieve data from sqlite. user can have more than 1 score

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.