79176042

Date: 2024-11-10 23:49:42
Score: 0.5
Natty:
Report link

I found the issue, It was simple, the uploadFlagToCustomer() function is inside a ViewModel and I am calling this function from an AlertDialog.Builder. when I removed that AlertDialog, its inserting value to SQLite.

Below is the code on the Activity

    private fun callDialog(database, flags) {
    flagViewModel.uploadFlagToCustomer(database, flags)
 /*   val bl = AlertDialog.Builder(this)
    bl.setTitle("Save/Clear Flags?")
    bl.setNeutralButton("Clear", null)
    bl.setPositiveButton(
        "Save & Exit"
    ) { dialog: DialogInterface?, _: Int -> flagViewModel.uploadFlagToCustomer(database, flags) }
    val d: Dialog = bl.create()
    d.setCanceledOnTouchOutside(false)
    d.setCancelable(false)
    d.setOnDismissListener { _: DialogInterface? ->
        flagViewModel.clearFlags(routeId)
    }
    d.show()*/
}

There was no issue with the SQlite it was this part that caused the problem

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Jisa Joy