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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:20:56+00:00 2026-05-29T05:20:56+00:00

SQLiteOpenHelper dbOpenHelper = new (ctx, nameofdb); SQLiteDatabase db = dbOpener.getWritableDatabase(); Do I have to

  • 0
SQLiteOpenHelper dbOpenHelper = new (ctx, nameofdb);
SQLiteDatabase db = dbOpener.getWritableDatabase();

Do I have to call .close() on both of these, or just one of them is enough? If yes, then which one?

SQLiteDatabase
SQLiteOpenHelper

The problem I am having is that I do not see one particular row in DDMS view in Eclipse, but when I use the Cursor to get it, it shows that I do have that entry. So I am wondering it might be caused by not closing the database properly? Anybody who can help would be great. 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-29T05:20:57+00:00Added an answer on May 29, 2026 at 5:20 am

    If you look at the docs for SQLiteOpenHelper.close()…

    public synchronized void close ()

    Close any open database object.

    It doesn’t close the SQLiteOpenHelper, it closes the database.

    Further to this, if you get your code right you can avoid dealing directly with the database object directly altogether.

    For example, if you have a query you use regularly to get a cursor for an adapter to populate a view, create a method in your SQLiteOpenHelper class and put the query into that.

    In other words, don’t get a reference to the actual database in your main code just get the SQLiteOpenHelper to do everything for you.

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

Sidebar

Related Questions

I have created a class call DatabaseHandler extending SQLiteOpenHelper. I want to explicting deleted
Okay full code now: DBOpenHelper: public class DBOpenHelper extends SQLiteOpenHelper { private SQLiteDatabase mDatabase;
If you extend SQLiteOpenHelper, for the Constructor you have to use a Context. I
Would it be OK to have a single instance of SQLiteOpenHelper as a member
I have created a sub class (DatabaseHelper) of SQLiteOpenHelper Class.Its has a constructor and
I am loading a database without problems in a SQLiteOpenHelper>>onCreate(SQLiteDatabase) method. However, when I
I created a table using the SQLiteOpenHelper: public void onCreate(SQLiteDatabase db) { // TODO
I have created SQLiteOpenHelper class to help me open write the database. but i
I have a DatabaseHelper class which extends SQLiteOpenHelper, what is a good practice to
The documentation at http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html#getWritableDatabase%28%29 states: Database upgrade may take a long time, you should

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.