0

I want to delete all data from SQLite table when I click the button then It create pdf file and then delete the data from the table I have created pdf file but not able to delete to the complete record it show error

//Dbhandler code
  public void deleteAll()
{
    SQLiteDatabase db = this.getWritableDatabase();
    db.execSQL("delete from "+ TABLE_Users);
    db.close();
}
//main activity code 
 document.close();

if (myPath.exists())
    myPath.delete();

openPdf(path);
// here I want to call the delete all user 
dbHandler.deleteAll();








 logs
 2021-04-08 08:22:00.213 13776-13803/com.j.usamaelectronics E/EGL_adreno: 
 CreateContext rcMajorVersion:3, minorVersion:0
 2021-04-08 08:22:00.288 13776-13803/com.j.usamaelectronics E/EGL_adreno: tid 
 13803: eglSurfaceAttrib(1582): error 0x3009 (EGL_BAD_MATCH)
   2021-04-08 08:22:09.227 13776-13803/com.j.usamaelectronics E/EGL_adreno: 
  tid 13803: eglSurfaceAttrib(1582): error 0x3009 (EGL_BAD_MATCH)
  2021-04-08 08:45:31.035 13776-13776/com.j.usamaelectronics 
  E/AndroidRuntime: FATAL EXCEPTION: main
 Process: com.j.usamaelectronics, PID: 13776
 java.lang.NullPointerException: Attempt to invoke virtual method 'void 

com.j.usamaelectronics.DbHandler.deleteAll()' on a null object reference at com.j.usamaelectronics.ShowallsaleitemActivity.createPdf(ShowallsaleitemActivity.java:197) at com.j.usamaelectronics.ShowallsaleitemActivity.takeScreenShot(ShowallsaleitemActivity.java:163) at com.j.usamaelectronics.ShowallsaleitemActivity.access$000(ShowallsaleitemActivity.java:46) at com.j.usamaelectronics.ShowallsaleitemActivity$1.onClick(ShowallsaleitemActivity.java:107) at android.view.View.performClick(View.java:5637)

0 Answers0