In the method of onCreate()my main action, I call the constructor of my dbManager, I call the public function that creates the instance SQLiteOpenHelper, and I call getWritableDatabase()on it. In UIThread, I add entries to the database and save these entries in an ArrayList. The other two threads verify that the ArrayList is doing the material, and not updating the list and database. Now I want to add a button to the user interface to delete database entries and lists with AsyncTask. I read that objectSQLiteOpenHelperstored in one database connection. Therefore, if there is one auxiliary instance, there is only one db connection. This connection can be used from multiple threads, and the SqliteDatabase object uses Java locks to preserve access serialization. So, if I have several threads writing to the database, will the thread wait until the previous one has completed its work?
Adding new functionality (delete everything) can create problems because I have to avoid the fact that one of the two threads can try to edit an entry that no longer exists. How can I achieve my goal? Thank.
source
share