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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:12:14+00:00 2026-05-18T20:12:14+00:00

Hey, I’ve got my database connection setup in an Android Application but LogCat keep’s

  • 0

Hey, I’ve got my database connection setup in an Android Application but LogCat keep’s telling me about a SQLite leak.

12-03 15:07:23.169: ERROR/Database(2509): Leak found
12-03 15:07:23.169: ERROR/Database(2509): java.lang.IllegalStateException: /data/data/com.domain/databases/db.db SQLiteDatabase created and never closed
12-03 15:07:23.169: ERROR/Database(2509):     at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1784)
12-03 15:07:23.169: ERROR/Database(2509):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:804)
12-03 15:07:23.169: ERROR/Database(2509):     at com.domain.DatabaseConnection.openDataBase(DatabaseConnection.java:118)
12-03 15:07:23.169: ERROR/Database(2509):     at com.domain.global.ZonesLoaded.InitZones(ZonesLoaded.java:32)
12-03 15:07:23.169: ERROR/Database(2509):     at com.domain.ZoneActivity.onCreate(ZoneActivity.java:34)
12-03 15:07:23.169: ERROR/Database(2509):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-03 15:07:23.169: ERROR/Database(2509):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2544)
12-03 15:07:23.169: ERROR/Database(2509):     at android.app.ActivityThread.startActivityNow(ActivityThread.java:2411)
12-03 15:07:23.169: ERROR/Database(2509):     at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
12-03 15:07:23.169: ERROR/Database(2509):     at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
12-03 15:07:23.169: ERROR/Database(2509):     at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:648)
12-03 15:07:23.169: ERROR/Database(2509):     at android.widget.TabHost.setCurrentTab(TabHost.java:320)
etc...

After reading other posts like here or here, it would suggest that I wasn’t implementing the close method in my DBAdapter class. However I did create this:

public synchronized void close()
{
    if(myDatabase != null)
        myDatabase.close();

    super.close();
}

I’m starting to wonder if it is down to how I’m using the database adapter, although I just tested my app on a much faster device (Samsung Galaxy S) and this worked with no problems whatsoever! Does anyone have any tips here?

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-05-18T20:12:14+00:00Added an answer on May 18, 2026 at 8:12 pm

    I had this problem too until I made sure to call close explicitly in my activity’s onPause method. I tend to follow the pattern of opening the DB on resume/create and close it before a pause (as with all other resources that hold state).

    To be very clear, I do not recommend opening/closing a DB on-demand or on an ad-hoc basis. It is almost always best to open the DB up early and keep it open for the duration of your activity and close it when the activity gets suspended.

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

Sidebar

Related Questions

Hey, I want to store application configuration data. Currently, I'm using INIs but they
Hey guys I am new to android development, I am currently making an application.The
Hey guys I have about 8 fieldSets and Im iterating over a list. I
Hey I thought about writing a function that prompts me in certain situations (perl
Hey I can't figure out an error I got. I had my App working
Hey everyone I am a newbie and would love some help. I got the
Hey guys, sorry I'm kind of new to programming, but I had a small
Hey guys I am making a terminal application using Swing and Apache Commons. I
Hey all i am probably overthinking this but how can i check the textbox
Hey guys I'm running this code in Android: public ServiceServer(String serverName) { this.serverName =

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.