I'm making an application by which i want the rows which were placed within the tables should get erased on mouse click once the activity restarts.

I've attempted the next approaches but didnot obtain the preferred result and also the same rows get placed again.

public void deleteDatabase(String databaseName) {
        context.deleteDatabase(databaseName);

    }

and

       public void deleteAll(){
           db.execSQL("TRUNCATE TABLE" +DATABASE_TABLE);
           db.execSQL("TRUNCATE TABLE" +DATABASE_TABLE_ICOn);
           db.execSQL("TRUNCATE TABLE" +DATABASE_TABLE_NAVIGATION);
           this.db.delete(DATABASE_TABLE, null, null);
           this.db.delete(DATABASE_TABLE_NAVIGATION,null, null);
           this.db.delete(DATABASE_TABLE_ICOn, null, null);
       }



      db = new WineDatabaseAdapter(HomePageWithPhoneIsOfflineDialog.this);

    final AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage("Your Phone is Offline")
            .setCancelable(false)
            .setPositiveButton("Go Online",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog1, int id1) {

                            if(WineDatabaseHelper.checkDataBase()==true){

                                db.deleteDatabase(WineDatabaseHelper.DATABASE_NAME);
                                //db.deleteAll();
                            }

What shall i actually do to resolve my problem. Thanks

Truncate isn't based on Sqlite so its easier to use Remove

The conventional method to remove all of the rows inside a SQL

Remove FROM MyTable

You may also execute VACUUM to compact the database when you're removing large amount of data and wish to shrink the database file.