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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:32:07+00:00 2026-05-20T00:32:07+00:00

Here is the error: 02-08 16:35:00.899: ERROR/Database(468): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor

  • 0

Here is the error:

02-08 16:35:00.899: ERROR/Database(468): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here

Except, well, I am. Here is the method where this problem is occuring:

    public static void getUpdates(String username, Context context) {
    HttpClient httpClient = new DefaultHttpClient();
    HttpPost httpPost = new HttpPost("http://10.0.2.2/tag/appgetfriendinfo.php");

    try {
        List<NameValuePair> nVPs = new ArrayList<NameValuePair>();
        nVPs.add(new BasicNameValuePair("username", username));

        httpPost.setEntity(new UrlEncodedFormEntity(nVPs));
        HttpResponse response = httpClient.execute(httpPost);

        ResponseHandler<String> rHandler = new BasicResponseHandler();
        String result = rHandler.handleResponse(response);

        JSONArray jArray = new JSONArray(result);
        for(int i = 0; i < jArray.length(); i++) {
            JSONObject jObj = jArray.getJSONObject(i);
            String userCheck = jObj.getString("username");
            TagDBAdapter dbHelper = new TagDBAdapter(context);
            dbHelper.open();//OPENING THE DATABASE
            Contact contact = new Contact();

            String first = jObj.getString("firstname");
            String last = jObj.getString("lastname");
            String name = first + " " + last;

            contact.setUsername(jObj.getString("username"));
            contact.setFirstName(first);
            contact.setLastName(last);
            contact.setName(name);
            contact.setPhoneNumber(jObj.getString("phonenumber"));
            contact.setEmail(jObj.getString("email"));
            contact.setHomePhone(jObj.getString("homephone"));
            contact.setWorkPhone(jObj.getString("workphone"));

            if(dbHelper.checkForExisting(userCheck) == true) {
                dbHelper.createContact(contact);
            }
            else {
                dbHelper.updateContactAuto(userCheck, contact);
            }
            dbHelper.close();//CLOSING THE DATABASE
        }

    } catch(ClientProtocolException e) {
        Log.e("GETUPDATES", "CPE", e);
        e.printStackTrace();
    } catch(IOException e) {
        Log.e("GETUPDATES", "IOE", e);
        e.printStackTrace();
    } catch(JSONException e) {
        Log.e("GETUPDATES", "JSONE", e);
        e.printStackTrace();
    }
}

As you can see on the lines I noted in //comments, I am opening AND closing the database, yet I am still getting the error. Here is what is strange though, the error’s source is in the SQLite’s open() method.

ERROR/Database(468): at com.tagapp.android.TagDBAdapter.open(TagDBAdapter.java:62)

Which is this:

    /**THESE ARE MY DBADAPTER'S OPEN AND CLOSE METHODS*/

    public TagDBAdapter open() throws SQLException {
    mDBHelper = new DatabaseHelper(m_context);
    mDb = mDBHelper.getWritableDatabase();
    return this;
}

public void close() {
    mDBHelper.close();
}

These are straight from Google’s notepad tutorial, and they have worked 100% for me in different instances. Does anyone have an idea of what is going on here? Thanks a lot.

  • 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-20T00:32:07+00:00Added an answer on May 20, 2026 at 12:32 am

    The problem is not the database object, it’s the cursor – you have an open cursor lying around somewhere.

    Make sure that all cursors are closed before you close the database. (Btw, if you want to be fancy, you can create a ContentProvider, use an SQLiteOpenHelper and not worry about closing it at all.)

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

Sidebar

Related Questions

I'm having an error where I am not sure what caused it. Here is
I get the following compilation error: error: expected `;' before 'it' Here's my code:
Hi guys anyone know what the helll is going on here? ERROR SNIPPET: Loading
I'm basically wondering what is included in each error level, as found here in
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
I've read here: Error 10048 when trying to open TcpChannel I am having what
I get this error when compiling the following source from here : Error 1
Could somebody please explain why I'm getting a compile error here - error C2558:

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.