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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:05:04+00:00 2026-06-12T07:05:04+00:00

My app inserts some data into its SQLite DB and the app confirms that

  • 0

My app inserts some data into its SQLite DB and the app confirms that the insert was successful.
However, if power is lost shortly afterward, the data is not visible after the mobile device fully reboots.

It seems that there is some caching going on – how can I ‘flush’ the buffer / cache ?

Note: the sqlite db is located on the main flash memory, not on the sdcard.

  • 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-12T07:05:05+00:00Added an answer on June 12, 2026 at 7:05 am

    Hi Someone Somewhere,

    If you want to guarantee that a DB write occurs, you should use transactions.

    ie: Here is a simple example which you could build off of.

    DatabaseHelper readDB = new DatabaseHelper(Context);
    SQLiteDatabase db = readDB.getWritableDatabase();
    
    String lastConnID = "1";
    String DATABASE_TABLE = "TestDB";
    String KEY_ROWID = "pkey";
    
    db.beginTransaction();
    db.update(DATABASE_TABLE, values, KEY_ROWID + "="
                        + "'" + lastConnID + "'", null);
    db.setTransactionSuccessful();
    db.endTransaction();
    

    A sample DatabaseHelperClass can be found here.

    When you call setTransactionSuccessful, the deed is done and the item should be committed to the DB. You should end the transaction right after this is called because it will still commit to the database even if an error occurs between setting the transaction successful and ending the transaction.

    Hopefully this helps you!
    Cheers.

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

Sidebar

Related Questions

I have a php script that inserts data from an Android app into a
I have android app that talks to server and syncs some data int SQLite
I am trying to insert some data into the database if the app is
I have a mobile app that is using LinqToDatasets to update/insert into a SQL
I have around 4000 entities that I need to insert into a Java App
I am working on a app in CI, I have a model that inserts
In my app, I insert pairs of spinners into a linearlayout, which is inside
I am currently working on an app, where I need to insert contacts into
I have a .NET app that I'd like to do some automated testing on.
I'm part way through building a fairly complex HTML5 web app, that retrieves its

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.