Deleteing a row in sqlite in android
<p>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..</p>

<p>I am using this code:</p>

<pre><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;
    }
</code></pre>

<p>My database contains data:</p>

<pre><code>id              heading                 Description
1               fgghsgahs               tyfgjhdfsdks
</code></pre>

<p>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.</p>

<p>My logcat is as follows:</p>

<pre><code>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)
</code></pre>
