Android Question Include more fields in a listview !!

MarcioCC

Member
Licensed User
Longtime User
Good afternoon, how do I include more fields in a listview I can only put a precise field add the field QUANTITY more I can not follow my code:

S.ExecNonQuery2 ("INSERT INTO PRODUCTS (rowid, CODBARRAS, QUANTITY) VALUES (NULL,?,?)", Array As String (Edtdescr.Text, EdtQtde.Text))

'If EdtQtde.Text <> "" Then
'S.ExecNonQuery2 ("INSERT INTO PRODUCTS (QUANTITY) VALUES (?)", Array As String (EdtQtde.Text))

C = s.ExecQuery ("SELECT CODBARRAS FROM PRODUCTS ORDER BY CODBARRAS, QUANTITY")

'SELECT codigbars, quantity from products

'Lvadiciona.Clear

If c.RowCount> 0 Then
For i = 0 To c.RowCount-1
C.Position = i


Lvadiciona.AddTwoLines (c.GetString ("CODBARRAS", "QUANTITY"))

Lvadiciona.SingleLineLayout.Label.TextSize = 11dip

It returns me a parameter error.
 

klaus

Expert
Licensed User
Longtime User
It returns me a parameter error.
Which error do you get?

How do you define ListView1.TwoLinesLayout?
You use Lvadiciona.AddTwoLines but you try to modify Lvadiciona.SingleLineLayout!?
So, do you use a single line layout or a two lines layout?
Be aware that the layout is the same for all entries.
You can combine single line and two lines, but each one has its own layout.
 
Upvote 0

MarcioCC

Member
Licensed User
Longtime User
Good evening Klaus, of the parameter error you have an example to send me how do I do it ?? Do I put 2 fields in the listview has another way ??
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
the parameter error you have an example to send me how do I do it ??

Your code should look like the following where S is the database and C the cursor:
B4X:
C = S.ExecQuery ("SELECT CODBARRAS, QUANTITY FROM PRODUCTS ORDER BY CODBARRAS, QUANTITY")
    If C.RowCount> 0 Then
        For i = 0 To c.RowCount-1
            C.Position = i
            Lvadiciona.AddTwoLines (C.GetString ("CODBARRAS"),C.GetString("QUANTITY"))
        Next
    Else
        Log($"No records found in table"$)
    End If
 
Upvote 0
Top