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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:19:15+00:00 2026-06-17T21:19:15+00:00

I have an app that depends on SQLite for data which is populated by

  • 0

I have an app that depends on SQLite for data which is populated by xmls shipped with the app in the assets folder.

  1. When you run the app the first time it sets a shared preference config_run = false.
  2. then i check if config_run = false then parse the xml and dump the data into db
  3. set config_run = true

Now i realize that when i have to push an update on Google Play and add more content into the XML. Even though i change the database version from 1 to 2. The import script wont run because shared preference config_run value will be set to true.

Any pointers on how to handle this situation ?

Scenarios

  1. First Instal – Ver = 1, DB V = 1 (Data is parsed and dumped into the database)
  2. Bugs Fixed and push and update but no data has changed – ver = 1.1, DB V = 1 (It should just replace the code and not upgrade or re-create the database)
  3. Upgraded the DATA and pushed a new update – ver 1.2, DB = 2 ( No new code but data has to be re-created)

The Flow of My App

  1. The App Starts Splash Activity. If Shared Pref – config_run is equal to false then it starts a Progress Dialog and parses and dumps the data into the database.
  2. Upon Parsing and Creating DB and dumping data it goes to MainActivity.

Second Case

  1. SplashActivity Runs and config_run = true so directly goes to MAin Activity.

As Suggested by few people below if i try to dumb the data into the database in onUpgrade of the SQLiteHelper it will happen only in MAinActivity as i dont open a Db connection in the SplashActivity and the Dialog Progress wont be displayed also.

  • 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-17T21:19:17+00:00Added an answer on June 17, 2026 at 9:19 pm

    Instead of setting your shared pref (config_run) to false and making it true, just set the database version into it. When you update your app, check whether you have the same version number in your shared pref. You can do this as shown below:

    configRun = settings.getInt("database_version", 0);
    
    if ((DBAdapter.DATABASE_VERSION) == configRun) 
    {
    //skip xml parsing
    }
    else
    {
    //first time configRun will be "0" and DBAdapter.DATABASE_VERSION will be 1
    // so you need to parse your xml here and set configRun =1
    //on update, change your DB version to 2. now again your configRun and DBAdapter.DATABASE_VERSION will mismatch and you can parse your xml.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a linux app that depends on the speed with which the user
I have an Android app that depends on a web service for data. I'd
I have an Setup project that installs App.exe. App.exe depends on 1) A third
I have a grails project that depends on some native code, which will vary
The scenario is the following: Lets say I have this application App that depends
I have a Cocoa App that depends on the main window being a certain
I have a silverlight 5 app that depends on several asynchronous calls to web
I'm running a Java app that depends on a few libraries (Axis2) which use
I develop finance app that should use different currency symbol which depends on the
I have a console app c# project that depends on NHibernate 3.3.2 and ShapArch.NHibernate

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.