Where Do I Close My Database When It Continuously Updates?
In my application, i have Contacts_sync.java class which synchronizes the contacts and offline_Messages.java which contain messages which are received by a user when he was offline
Solution 1:
Don't close the database. There is no need (data gets safely written to persistent storage at the earliest opportunity anyway). Open it once, on application startup, and reuse the same connection throughout your application's lifetime.
Note that it's important to keep a single connection, perhaps as a static
member of your Application
class, so that it doesn't trigger the warning message you saw when the garbage collector tries to clean it up.
Post a Comment for "Where Do I Close My Database When It Continuously Updates?"