unable to insert data into sqlite database for android device

前端 未结 2 1024
慢半拍i
慢半拍i 2021-01-27 05:47

I\'ve met an unknown error while inserting data into the database. The LogCat had been display \"unable to insert data\", however, the code that I\'ve used is copied from anothe

相关标签:
2条回答
  • 2021-01-27 06:42

    AlertDialog.Builder builder = new AlertDialog.Builder(this); don`t use "this" inside any click listener , because it refer current view instead of parent view. Try to use className.this like as follows...

     AlertDialog.Builder builder = new AlertDialog.Builder(className.this);
    
    0 讨论(0)
  • 2021-01-27 06:50

    You need to set the dbopener as a global variable and move dbopener.close(); from OnStart() to OnDestroy() since you closed the DB before you insert the data

    0 讨论(0)
提交回复
热议问题