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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:04:01+00:00 2026-05-26T20:04:01+00:00

I want to remove all rows that i entered from my SQLite database table.

  • 0

I want to remove all rows that i entered from my SQLite database table. The table name is tbltask.
I tried to drop the table and delete * from table, but those are giving me runtime errors.
I want to trigger this event in Button OnClickListner event.

Following code is what I tried:

String delete = "DELETE FROM "+DATABASE_TABLE;
db.rawQuery(delete, null);
db.delete(DATABASE_TABLE, null, null);

LogCat:

11-15 17:45:04.660: DEBUG/AndroidRuntime(300): Shutting down VM
11-15 17:45:04.660: WARN/dalvikvm(300): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 
11-15 17:45:04.710: ERROR/AndroidRuntime(300): FATAL EXCEPTION: main 
11-15 17:45:04.710: ERROR/AndroidRuntime(300): java.lang.NullPointerException 
11-15 17:45:04.710: ERROR/AndroidRuntime(300): at database.com.android.DatabaseAccess.drop(DatabaseAccess.java:258) 
11-15 17:45:04.710: ERROR/AndroidRuntime(300): at com.android.ExtraActivity$3$1.onClick(ExtraActivity.java:61) 
11-15 17:45:04.710: ERROR/AndroidRuntime(300): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:158) 
11-15 17:45:04.710: ERROR/AndroidRuntime(300): at android.os.Handler.dispatchMessage(Handler.java:99) 
11-15 17:45:04.710: ERROR/AndroidRuntime(300): at android.os.Looper.loop(Looper.java:123) 
11-15 17:45:04.710: ERROR/AndroidRuntime(300): at android.app.ActivityThread.main(ActivityThread.java:4627) 
11-15 17:45:04.710: ERROR/AndroidRuntime(300): at java.lang.reflect.Method.invokeNative(Native Method) 
11-15 17:45:04.710: ERROR/AndroidRuntime(300): at java.lang.reflect.Method.invoke(Method.java:521) 
11-15 17:45:04.710: ERROR/AndroidRuntime(300): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 
11-15 17:45:04.710: ERROR/AndroidRuntime(300): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 
11-15 17:45:04.710: ERROR/AndroidRuntime(300): at dalvik.system.NativeStart.main(Native Method) 
11-15 17:45:04.781: WARN/ActivityManager(58): Force finishing activity com.android/.ExtraActivity 
11-15 17:45:05.320: WARN/ActivityManager(58): Activity pause timeout for HistoryRecord{45061a70 com.android/.ExtraActivity} 
11-15 17:45:14.857: WARN/ActivityManager(58): Launch timeout has expired, giving up wake lock! 
11-15 17:45:15.402: WARN/ActivityManager(58): Activity idle timeout for HistoryRecord{450141d0 com.android/.WelcomActivity} 
11-15 17:45:20.572: WARN/ActivityManager(58): Activity destroy timeout for HistoryRecord{45061a70 com.android/.ExtraActivity}

This is the LogCat output I get for following query:

        String delete = "DELETE FROM taskTable";
    db.execSQL(delete);
  • 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-26T20:04:02+00:00Added an answer on May 26, 2026 at 8:04 pm

    Just do:

    db.delete(DATABASE_TABLE, null, null);
    

    Note that using rawQuery should work, but can be a potential security risk.

    EDIT:

    About the problem you have when you use

    db.execSQL
    

    Read the documentation, it says you should not use execSQL with INSERT, DELETE, UPDATE or SELECT

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

Sidebar

Related Questions

I erroneously delete all the rows from a MS SQL 2000 table that is
I want to remove all rows apart from the row with id 'row0' from
Hello everone I'm removing rows from a dataset. All rows that I want to
I want to delete all rows in a table with a specific ID (not
I want to remove all files from Git at ~/bin/. I run git rm
I want to remove all special characters from a string. Allowed characters are A-Z
I want to remove all vba-modules from an MS Word template using VBScript. I
I want to remove all non-alphanumeric and space characters from a string. So I
I build dynamically my HTML table from database like that: for (i = 0;
I want to delete all the selected rows when the delete button is pressed.

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.