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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:26:02+00:00 2026-06-12T00:26:02+00:00

In my application, i have Contacts_sync.java class which synchronizes the contacts and offline_Messages.java which

  • 0

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 and it checks for new messages every five seconds.

Now the problem is on application start-up, the service for contact synchronization starts and every five seconds another service for checking offline messages starts too.

So in this case how do i manage to close the database. If i close the database in offlineMessage service then if there is any ongoing process for Contact synchronization then it gives me database close error.

Here is my Logcat

09-27 13:22:45.125: E/Database(6970): close() was never explicitly called on database 'sipchat.db' 
09-27 13:22:45.125: E/Database(6970): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
09-27 13:22:45.125: E/Database(6970):   at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1849)
09-27 13:22:45.125: E/Database(6970):   at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:822)
09-27 13:22:45.125: E/Database(6970):   at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:856)
09-27 13:22:45.125: E/Database(6970):   at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:849)
09-27 13:22:45.125: E/Database(6970):   at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:556)
09-27 13:22:45.125: E/Database(6970):   at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:203)
09-27 13:22:45.125: E/Database(6970):   at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:118)
09-27 13:22:45.125: E/Database(6970):   at org.sipchat.sipua.ui.DatabaseHelper.<init>(DatabaseHelper.java:39)
09-27 13:22:45.125: E/Database(6970):   at org.sipchat.sipua.ui.Contact_sync.onCreate(Contact_sync.java:110)
09-27 13:22:45.125: E/Database(6970):   at android.app.ActivityThread.handleCreateService(ActivityThread.java:1949)
09-27 13:22:45.125: E/Database(6970):   at android.app.ActivityThread.access$2500(ActivityThread.java:117)
09-27 13:22:45.125: E/Database(6970):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:989)
09-27 13:22:45.125: E/Database(6970):   at android.os.Handler.dispatchMessage(Handler.java:99)
09-27 13:22:45.125: E/Database(6970):   at android.os.Looper.loop(Looper.java:130)
09-27 13:22:45.125: E/Database(6970):   at android.app.ActivityThread.main(ActivityThread.java:3687)
09-27 13:22:45.125: E/Database(6970):   at java.lang.reflect.Method.invokeNative(Native Method)
09-27 13:22:45.125: E/Database(6970):   at java.lang.reflect.Method.invoke(Method.java:507)
09-27 13:22:45.125: E/Database(6970):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
09-27 13:22:45.125: E/Database(6970):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
09-27 13:22:45.125: E/Database(6970):   at dalvik.system.NativeStart.main(Native Method)

Any idea and suggestions will be appreciated
Thanks

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

    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.

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

Sidebar

Related Questions

I have an application which has a contacts module and I am using JAVA
I have a PHP application which connects to Microsoft Exchange server to retrieve 'Contacts'
I have a grails application where I have contacts which belongs to another domain
I have a application and I want to show the contacts are sorted by
I have an application written in Delphi that adds / updates contacts in outlook.
I have seen the Contacts in iPhone Simulator. I want to create an application
I have an iPhone application that adds new contacts via the Address Book Framework.
I have property management application consisting of tables: tenants landlords units properties vendors-contacts Basically
I have a tab-bar and navigation controller application (like Youtube app or Contacts app).
I am developing an application in xmpp.I have gmail and facebook contacts in a

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.