Remove
db.close();
If you try another operation after closing the database, it will give you that exception.
The documentation says:
Releases a reference to the object, closing the object…
Also, check out
Android SQLite closed exception about a comment from an Android Framework engineer which states that it is not necessary to close the database connection, however this is only when it is managed in a ContentProvider
.
Related Contents:
- Simple export and import of a SQLite database on Android
- Using Singleton design pattern for SQLiteDatabase
- How to use an existing database with an Android application [duplicate]
- Setting Singleton property value in Firebase Listener
- Singletons vs. Application Context in Android?
- SQlite Getting nearest locations (with latitude and longitude)
- Any good ORM tools for Android development? [closed]
- Foreign key constraints in Android using SQLite? on Delete cascade
- SQLite in Android How to update a specific row
- Database not copying from assets
- Android search with Fragments
- Which Android Data Storage Technique to use?
- Get generated id after insert
- Get application context from non activity singleton class
- How to persist permission in android API 19 (KitKat)?
- attempt to re-open an already-closed object: SQLiteDatabase
- SQLiteOpenHelper failing to call onCreate?
- Upgrade SQLite database from one version to another?
- Android : Table has no column named “variable name” MySql Database error
- Light weight alternative to Hibernate? [closed]
- Sending Email in Android using JavaMail API without using the default/built-in app
- What is an efficient way to implement a singleton pattern in Java? [closed]
- Download a file with Android, and showing the progress in a ProgressDialog
- How to render a PDF file in Android
- Https Connection Android
- Subscript and Superscript a String in Android
- Should I actually remove the ValueEventListener?
- Why retrieving Google Directions for Android using KML data is not working anymore? [duplicate]
- org.apache.http.entity.FileEntity is deprecated in Android 6 (Marshmallow)
- Can we connect remote MySQL database in Android using JDBC? [closed]
- Android database encryption
- READ_EXTERNAL_STORAGE permission for Android
- ListView is blank while using getFilter function
- Create a new TextView programmatically then display it below another TextView
- Difference between getExternalFilesDir and getExternalStorageDirectory()
- The import android.support cannot be resolved
- How to update a TextView of an Activity from another class
- Error building AAB – Flutter (Android) – Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available
- java Lang UnsupportedClassVersion Error in Xamarin Studio
- Can’t get location and email using Facebook API
- Create a Bitmap/Drawable from file path
- Android Studio: failed to complete gradle execution, cause is empty
- Android studio – Failed to find target android-18
- How do I remove a specific element from a JSONArray?
- Setting a spinner onClickListener() in Android
- NTAG212 Mifare Ultralight with Authentication
- Parsing ksoap2 response
- Where is main() in Android?
- how to create table if it doesn’t exist using Derby Db
- android device id confusion