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

  • Home
  • SEARCH
  • 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 6857185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:59:04+00:00 2026-05-27T01:59:04+00:00

I read lot of about this topic but no solution can be used in

  • 0

I read lot of about this topic but no solution can be used in my application.
Suppose there are few services and lot of activities that need to access db.
Of course only one activity is active. But in the worst scenario there is one activity and two services running background accessing db.

So when I close db from activity’s onResume – service accessing db would throw exception.
And same is when I close db from service’s onDestroy and there is opened cursor in activity.

I hold some kind of DBManager in my application object as singleton. I init DBManager in Application.onCreate. But there is no place to close db without risking that another Service and activity is accesing this.

So now I never close DB – are there any consequencies doing that?
Is there same simple(or not too complicated) solution to close DB?

here are my applications in market

russian version

english version

  • 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-05-27T01:59:05+00:00Added an answer on May 27, 2026 at 1:59 am

    I do the same, I use a singleton database object and never close it until my application is destroyed. I didn’t notice any issues so far. A more detailed answer is here:

    https://stackoverflow.com/a/4842251/448625

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

Sidebar

Related Questions

I have read a lot of topics about this error message but I can't
I have read a lot about this issue but mine still seems to be
So i read a lot about why this implementation isn't thread-safe. But I didn't
I'm really confused about this, tried to read a lot about diagrams but I
I know there are a lot of other questions on SO about this topic,
I read a lot about this problem on Stackoverflow but not of the Helps
I've read a lot of information on this topic and we are about to
I´ve read a lot of posts about this but all of them were to
I have read really a lot of posts about this topic, however nothing works
First of all, I know there is a lot of questions about this topic.

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.