Note that there are some explanatory texts on larger screens.

plurals
  1. POReopen SQLiteOpenHelper when my application is stopped as "close()" was never explicitly called on database"
    primarykey
    data
    text
    <p>I'm using the <code>SQLiteOpenHelper</code>. When my application is normally closed, the database is closed normally in the method <code>onDestroy()</code>, too. When it's force closed, the database is left open and later, when my application tries to read the database using <code>getReadableDatabase()</code>, it crashed with the following message:</p> <blockquote> <p><code>09-26 13:45:30.995: ERROR/Database(12632): close() was never explicitly called on database</code></p> </blockquote> <p>Here is the full LogCat:</p> <pre><code>09-27 03:10:04.331: ERROR/Database(391): close() was never explicitly called on database '/data/data/myApplication/databases/DownloadDatabase1' 09-27 03:10:04.331: ERROR/Database(391): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here 09-27 03:10:04.331: ERROR/Database(391): at android.database.sqlite.SQLiteDatabase.&lt;init&gt;(SQLiteDatabase.java:1847) 09-27 03:10:04.331: ERROR/Database(391): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:820) 09-27 03:10:04.331: ERROR/Database(391): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:854) 09-27 03:10:04.331: ERROR/Database(391): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:847) 09-27 03:10:04.331: ERROR/Database(391): at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:544) 09-27 03:10:04.331: ERROR/Database(391): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:203) 09-27 03:10:04.331: ERROR/Database(391): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:118) 09-27 03:10:04.331: ERROR/Database(391): at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:187) </code></pre> <p>I followed the stack trace and I guess the exception is because of the following line of code:</p> <blockquote> <p><code>setLocale(Locale.getDefault());</code> </p> </blockquote> <p>Th code above is from the file <a href="http://hi-android.info/src/android/database/sqlite/SQLiteDatabase.java.html" rel="nofollow noreferrer">SQLiteDatabase.java</a>. Any suggestions on how to solve this problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload