I am trying to develop a Notes application where I can save list of notes. These notes will be saved in SQLite DataBase. I have set a button to delete the created note. When I click on this butting during run time (no complete time error) it is giving me a mentioned error. Kindly help in resolving this issue.
I tried to develop this app by reading and copying the code from
https://github.com/hussien89aa/KotlinUdemy/tree/master/Android/NoteApp/StartUp
inner class MyNotesAdapter : BaseAdapter {
var listNotesAdapter = ArrayList<note>()
var context: Context? = null
constructor(listNotesAdapter: ArrayList<note>) : super() {
this.listNotesAdapter = listNotesAdapter
this.context = context
}
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
var myView = layoutInflater.inflate(R.layout.ticket, null)
var myNote = listNotesAdapter[position]
myView.tvTitle.text = myNote.nodeName
myView.tvDes.text = myNote.nodeDes
myView.delete.setOnClickListener(View.OnClickListener {
var dbManager = DbManager(this.context!!) //This is the line where I am getting error.
val selectionArgs = arrayOf(myNote.nodeID.toString())
dbManager.Delete("ID=?", selectionArgs)
LoadQuery("%")
})