Android Question get Content label Inside CustomListstView

victormedranop

Well-Known Member
Licensed User
Longtime User
Hi, to this amazing forum.

i got a simple function that generate this
is there a way that i can get the text of an label inside the custom list view ?


here is the function.

B4X:
Private Sub CreateItem(Width As Int, Title As String, Image As String, Content As String) As Panel
    Dim p As B4XView = xui.CreatePanel("")
    Dim height As Int = 280dip
    If GetDeviceLayoutValues.ApproximateScreenSize < 4.5 Then height = 310dip
    p.SetLayoutAnimated(0, 0, 0, Width, height)
    p.LoadLayout("Card1")
    
    lblTitle.Text = Title
    lblContent.Text = Content
    SetColorStateList(lblAction1, xui.Color_LightGray, lblAction1.TextColor)
    SetColorStateList(lblAction2, xui.Color_LightGray, lblAction2.TextColor)
    'ImageView1.SetBitmap(xui.LoadBitmapResize(File.DirAssets, Image, ImageView1.Width, ImageView1.Height, True))
    ImageView1.SetBitmap(xui.LoadBitmap(File.DirAssets, Image)) ',50%x, ImageView1.Height, True))
    Return p
End Sub

screen.jpeg
 

Mahares

Expert
Licensed User
Longtime User
is there a way that i can get the text of an label inside the custom list view ?
B4X:
Sub CLV1_ItemClick (Index As Int, Value As Object)  'assumes all views are children of a common panel
    Dim p As B4XView =CLV1.GetPanel(Index)
    Dim lt As B4XView =p.GetView(0).GetView(3) 'assumes the label is in the 4th position in the card layout
    Log(lt.Text)

    Dim lc As B4XView = p.GetView(0).GetView(4)  'assumes the label is in the 5th position in the card layout
    Log(lc.Text)
End Sub
 
Upvote 2

victormedranop

Well-Known Member
Licensed User
Longtime User
B4X:
Sub CLV1_ItemClick (Index As Int, Value As Object)  'assumes all views are children of a common panel
    Dim p As B4XView =CLV1.GetPanel(Index)
    Dim lt As B4XView =p.GetView(0).GetView(3) 'assumes the label is in the 4th position in the card layout
    Log(lt.Text)

    Dim lc As B4XView = p.GetView(0).GetView(4)  'assumes the label is in the 5th position in the card layout
    Log(lc.Text)
End Sub


I Will said againg. Amazing !!!!?!!!!
 
Upvote 0
Top