Android Question B4XPlusMinus value change in xCustomListView

Hi, I'm having a trouble in my project with B4XPlusMinus. I'm using panel as a cell (card) for xcustomlistview. In my panel I'm using B4XPlusMinus for change item quantity.

This is what it looks like,
Screenshot_20200602_162644_b4a.example.jpg

My problem is I can get specific value from panel (which panel/button I just clicked) by using below code,
B4X:
    Dim index As Int = CLV.GetItemFromView(Sender)
    Dim pnl1 As B4XView = CLV.GetPanel(index)
    Dim pnl2 As B4XView = pnl1.GetView(0)
    'example : Log(pnl2.GetView(6).Text)

But when I use above code for B4XPlusMinus1_ValueChanged (Value As Object) it giving me an error,

java.lang.ClassCastException: b4a.example.b4xplusminus cannot be cast to android.view.View

I want to change B4XPlusMinus value and save that value in SQLite database. I don't know how to get which panel that B4XPlusMinus belongs.

this is the code I've used,
B4X:
Sub B4XPlusMinus1_ValueChanged (Value As Object)
    Dim index As Int = CLV.GetItemFromView(Sender)
    Dim pnl1 As B4XView = CLV.GetPanel(index)
    Dim pnl2 As B4XView = pnl1.GetView(0)
    SQL1.ExecNonQuery($"UPDATE cart(quantity) VALUES (${Value}) WHERE id=${pnl2.GetView(6).Text}"$)
End Sub

And this is the error,
java.lang.ClassCastException: b4a.example.b4xplusminus cannot be cast to android.view.View

I hope you can understand what I'm saying. Sorry about my English language. If anyone know how to fix this, Please let me know.

Thank you
 
Last edited:
Its working now. I've changed the SQL query into this,
B4X:
SQL1.ExecNonQuery2("UPDATE cart SET quantity=? WHERE id = ?",Array As String(Value,pnl2.GetView(6).Text))

Thank you Erel :)
 
Upvote 0
Top