I have a problem guys..
I have an application which needs to click an Item in the ListView from the database. And if I clicked the item in the listview, it will retrieve the value coming from the database into the text and spinner object.
In the EditText, the value retrieved was okay. But in the spinner, I can't retrieve the value of my particular column in the database to be displayed in the spinner (only one value must be displayed as i click an item in the listview).
Here's my code:
Please help guys. Thanks!
I have an application which needs to click an Item in the ListView from the database. And if I clicked the item in the listview, it will retrieve the value coming from the database into the text and spinner object.
In the EditText, the value retrieved was okay. But in the spinner, I can't retrieve the value of my particular column in the database to be displayed in the spinner (only one value must be displayed as i click an item in the listview).
Here's my code:
B4X:
Sub ListView1_ItemClick (Position As Int, Value As Object)
Main.clicksound.play
Dim idvalue As String
Dim countIt As Int
Dim ID As String
idvalue = Value
countIt = idvalue.IndexOf("-") 'find location of sperator
idvalue = idvalue.SubString2(0,countIt) 'find first part of label text
ID = idvalue
Main.cursor1 = Main.sql1.ExecQuery("SELECT * FROM tblProduct where ID = '" & ID & "' ")
For i = 0 To Main.cursor1.RowCount - 1
Main.cursor1.Position = i
txtMed.Text = Main.cursor1.GetString("BID")
txtQty.Text = Main.cursor1.GetString("prodName")
spnCategory.Add(Main.cursor1.GetString("prodCategory")) 'this code doesnt retrived the value of my category into the spinner
txtCat1.Text = Main.cursor1.GetString("prodCategory")
Next
End Sub
Please help guys. Thanks!