Android Question xCustomListView

Nickle

Member
Licensed User
Longtime User
I am pulling data from remote DB and Passing them into xCustomListView. I am able to Pass the 1st field from the remote DB to the 1st field on xCustomListView. How do I get remaining 2 Fields (AmtPiad and Oustanding on the listView.

B4X:
Private Sub Createitem(lv1 As String,iv As itemValue) As B4XView   
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0,0,0,100%x, 90dip)
    p.LoadLayout("pmtItemLayout")
    txtCarNumber.Text = lv1
    Return p
End Sub


Sub GetAllPayments
    Dim req As DBRequestManager = CreateRequest
    Dim cmd As DBCommand = CreateCommand("SelectAllPayments", Null)
    Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
    If j.Success Then
        req.HandleJobAsync(j, "req")
        Wait For (req) req_Result(res As DBResult)
        'work with result
        Log(res.Columns)
        'Log(res.Rows)
        'spnCarNumber.Clear
        For Each row() As Object In res.Rows   
            'Passing CarNumber Value to CreateItem
            Dim iv As itemValue
            iv.Initialize
            iv = row(res.Columns.Get("CarNumber"))
            CLV.Add(Createitem(iv,iv),iv)
            
            'Want to Pass remaing Fields to CreateItem and show on pmtItemLayout
            AmtPiad = row(res.Columns.Get("AmtPiad"))
            Oustanding = row(res.Columns.Get("Oustanding"))
            Log("Payment Details:" & imgLocation & ":" & iv & ":" & AmtPiad & ":" & ":" & Oustanding)   
        Next
    Else
        Log("ERROR: " & j.ErrorMessage)
    End If
    j.Release
End Sub
 

Nickle

Member
Licensed User
Longtime User
Thanks for the prompt support.

I made some changes to the code and am able to get all the missing fields unto pmtItemLayout except for my imageView. I am using using ImageDownloader. Not sure why Images are not been loaded. There is no error generated either.

B4X:
Private Sub Createitem As B4XView
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, 100%x, 90dip)
    p.LoadLayout("PmtItemLayout")
    ImageView1.Initialize("me")
    links.Put(ImageView1, imgLocation) ' ---> imgLocation is from DB request in Sub GetAllPayments
    txtCarNumber.Text = CarNumber
    txtPayments.Text = AmtPaid
    txtOutstanding.Text = Oustanding
    Return p
End Sub


Sub GetAllPayments
    Dim req As DBRequestManager = CreateRequest
    Dim cmd As DBCommand = CreateCommand("SelectAllPayments", Null)
    Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
    If j.Success Then
        req.HandleJobAsync(j, "req")
        Wait For (req) req_Result(res As DBResult)
        'work with result
        Log(res.Columns)
        For Each row() As Object In res.Rows   
             imgLocation  = row(res.Columns.Get("imgLocation"))
             CarNumber = row(res.Columns.Get("CarNumber"))
             AmtPaid  = row(res.Columns.Get("AmtPiad"))
             AmtDue  = row(res.Columns.Get("AmtDue"))
             Oustanding  = row(res.Columns.Get("Oustanding"))
            Log("Payment Details:" & imgLocation & ":" & CarNumber & ":" & AmtPaid & ":" & AmtDue & ":" & Oustanding)
            CLV.Add(Createitem,"")
        Next
    Else
        Log("ERROR: " & j.ErrorMessage)
    End If
    j.Release
End Sub

 
Upvote 0

Nickle

Member
Licensed User
Longtime User
Do you mean in the Designer for PmtItemLayout.

ImageView is already part and expect that it loads with the rest of the items when I load, but that does not work. Any help will be appreciated.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…