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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:12:10+00:00 2026-06-10T09:12:10+00:00

I am a noob to android and I am trying to update a sqlite

  • 0

I am a noob to android and I am trying to update a sqlite row entry by string as opposed to row number. I have no problems creating an entry and then deleting an entry by string. However, when i attempt to update an entry by string i get a null pointer exception? Any help is greatly appreciated.

My code for deleting an entry that works fine:

public void deleteEntry(String coin) throws SQLException{
    String[] whereArgs = new String[] { coin };
    ourDatabase.delete(DATABASE_TABLE, KEY_NAME + "=?", whereArgs); 

My code for updating an entry that doesn’t work:

public void updateEntry(String mCoin, String mQuantity, String mValue) throws SQLException{
    // TODO Auto-generated method stub
    String[] whereArgs = new String[] { mCoin };
    ContentValues cvUpdate = new ContentValues();
    cvUpdate.put(KEY_NAME, mCoin);
    cvUpdate.put(KEY_QUANTITY, mQuantity);
    cvUpdate.put(KEY_VALUE, mValue);
    ourDatabase.update(DATABASE_TABLE, cvUpdate, KEY_NAME + "=?", whereArgs);   
}

My LogCat:

08-27 01:16:13.734: E/Cursor(1886): Finalizing a Cursor that has not been deactivated or closed. database = /data/data/com.example.portfolio/databases/PortfolioDatabase, table = cointypeTable, query = SELECT _id, cointype_name, cointype_quantity, cointype_value FROM cointypeTable
08-27 01:16:13.734: E/Cursor(1886): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
08-27 01:16:13.734: E/Cursor(1886):     at android.database.sqlite.SQLiteCursor.<init>(SQLiteCursor.java:210)
08-27 01:16:13.734: E/Cursor(1886):     at  android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:53)
08-27 01:16:13.734: E/Cursor(1886):     at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1345)
08-27 01:16:13.734: E/Cursor(1886):     at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1229)
08-27 01:16:13.734: E/Cursor(1886):     at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1184)
08-27 01:16:13.734: E/Cursor(1886):     at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1264)
08-27 01:16:13.734: E/Cursor(1886):     at com.example.portfolio.PortfolioDatabase.getData(PortfolioDatabase.java:76)
08-27 01:16:13.734: E/Cursor(1886):     at com.example.portfolio.Portfolio.add(Portfolio.java:1305)
08-27 01:16:13.734: E/Cursor(1886):     at com.example.portfolio.Portfolio.onItemSelected(Portfolio.java:836)
08-27 01:16:13.734: E/Cursor(1886):     at android.widget.AdapterView.fireOnSelected(AdapterView.java:864)
08-27 01:16:13.734: E/Cursor(1886):     at android.widget.AdapterView.access$200(AdapterView.java:42)
08-27 01:16:13.734: E/Cursor(1886):     at android.widget.AdapterView$SelectionNotifier.run(AdapterView.java:830)
08-27 01:16:13.734: E/Cursor(1886):     at android.os.Handler.handleCallback(Handler.java:587)
08-27 01:16:13.734: E/Cursor(1886):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-27 01:16:13.734: E/Cursor(1886):     at android.os.Looper.loop(Looper.java:123)
08-27 01:16:13.734: E/Cursor(1886):     at android.app.ActivityThread.main(ActivityThread.java:4627)
08-27 01:16:13.734: E/Cursor(1886):     at java.lang.reflect.Method.invokeNative(Native Method)
08-27 01:16:13.734: E/Cursor(1886):     at java.lang.reflect.Method.invoke(Method.java:521)
08-27 01:16:13.734: E/Cursor(1886):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-27 01:16:13.734: E/Cursor(1886):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-27 01:16:13.734: E/Cursor(1886):     at dalvik.system.NativeStart.main(Native Method)
  • 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-10T09:12:12+00:00Added an answer on June 10, 2026 at 9:12 am

    From your logcat, it seems you forgot to close the cursor or database somewhere.
    Please can you post the code where you are calling these methods.

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

Sidebar

Related Questions

I'm a noob to android and im am trying to query a sqlite table.
I'm a noob to android development and i am trying to remove a string
android noob... I have two tables, with a one to many relationship between country_tbl
Im an Android noob, coming from objC, I have a very stupid question (project
Sorry I am a noob, I am trying to learn about sqlite databases using
This is an Android noob question. I am trying to start an activity of
i have to show some operations in Android,,, but Im having some noob problem,
Im a noob to android and I am trying to run a query on
I'm a noob to Android, and I am trying to figure out how to
Okay, first, I'm a noob at android programming. I have taken some Java, but

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.