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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:34:18+00:00 2026-06-16T05:34:18+00:00

In my application i have a database,in that i have 1 table containing 3

  • 0

In my application i have a database,in that i have 1 table containing 3 columns.I want to delete a row in the table bu using the id of that table..

I am using this code:

public long DeleteStory(int rowId)
    {
        System.out.println("pos="+rowId);
        long del=db.delete(DATABASE_TABLE, KEY_ROWID + "="+rowId,null);
        System.out.println("edl="+del);
        return del;
    }

My database contains data:

id              heading                 Description
1               fgghsgahs               tyfgjhdfsdks

But it is showing as nullpointer exception..I tried a lot ,,but i can’t able to solve it.Help me to solve this..Thanks in advance.

My logcat is as follows:

12-22 10:34:50.796: I/System.out(1207): pppppppp=1
12-22 10:34:50.816: I/System.out(1207): pos=1
12-22 10:34:50.816: D/AndroidRuntime(1207): Shutting down VM
12-22 10:34:50.816: W/dalvikvm(1207): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
12-22 10:34:50.816: E/AndroidRuntime(1207): Uncaught handler: thread main exiting due to uncaught exception
12-22 10:34:50.836: E/AndroidRuntime(1207): java.lang.NullPointerException
12-22 10:34:50.836: E/AndroidRuntime(1207):     at com.newspaper.DBadapter.DeleteStory(DBadapter.java:89)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at com.newspaper.SavedStoriesActivity.onOptionsItemSelected(SavedStoriesActivity.java:64)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at android.app.Activity.onMenuItemSelected(Activity.java:2170)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:730)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:139)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:525)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at android.view.View.onTouchEvent(View.java:4179)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at android.widget.TextView.onTouchEvent(TextView.java:6541)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at android.view.View.dispatchTouchEvent(View.java:3709)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at android.os.Looper.loop(Looper.java:123)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at android.app.ActivityThread.main(ActivityThread.java:4363)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at java.lang.reflect.Method.invokeNative(Native Method)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at java.lang.reflect.Method.invoke(Method.java:521)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
12-22 10:34:50.836: E/AndroidRuntime(1207):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
12-22 10:34:50.836: E/AndroidRuntime(1207):     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-16T05:34:19+00:00Added an answer on June 16, 2026 at 5:34 am

    The LogCat shows that this line is throwing the NullPointerException:

    long del=db.delete(DATABASE_TABLE, KEY_ROWID + "="+rowId,null);
    

    Which means the db is null. Do you have an open() method in your database adapter? You need to call getWritableDatabase() on your SQLiteOpenHelper object to initialize db.

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

Sidebar

Related Questions

In the database, I have a definition table that is read from the application
I have an application that has a status table see Database best practices -
I have an application in XCode using the sqlite/coredata database and that has already
I have an Android application that uses the Android database to create tables and
I have a completely empty RavenHQ database that's linked to my Appharbor application. The
I have a database in my local machine. I have a C# application that
I have a database on SQL Server 2008. I have an ASP.NET application that
We have an application that has a database full of polygons (currently stored as
I have an application that stores images in a database. Now I have learned
We have an application that uses Hibernate's 2nd level caching to avoid database hits.

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.