Android Question UltimateListView change label text by button click

Alexander Stolte

Expert
Licensed User
Longtime User
Hey Community,

I create a list with the UltimateListView and fill the list with my layout, on this layout are 3 Buttons and any labels.

Here a small section:

How can i give the first label +1 when i press the smylie? the Smylie is an Button.

I've tried it, but do not come any further:

B4X:
Sub ulv_ItemClick(ItemID As Long, Position As Int, ClickedPanel As Panel)
    'Log(ItemID)
   Dim pnl_main As Panel = ClickedPanel.GetView(0)
    Dim btn_up As Button = pnl_main.GetView(6)
    Dim lbl_counter As Label = pnl_main.GetView(5)
   
    'if counting = 1 Then
        'opo = lbl_counter.Text
        'ToastMessageShow(opo, True)
        'lbl_counter.Text = opo +1
        'counting = 0
    'End If
'    counting = lbl_counter
    'Log(btn_up.)
   
   
End Sub

Thanks for help!
 

Alexander Stolte

Expert
Licensed User
Longtime User
In the documentation is the following:

Does anyone have an example, how the code looks like?
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
i dont use maps.

B4X:
Sub clv2_LayoutCreator(LayoutName As String, LayoutPanel As Panel)
    LayoutPanel.LoadLayout("frm_mainlayout")
End Sub

Sub clv2_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)
    Dim Panel1 As Panel = LayoutPanel.GetView(0)
    Dim lbl_content As Label = Panel1.GetView(0)
    lbl_content.Text = "Nur mit Seil und Haken gesichert auf einem schmalen Grat balancieren."

Sub clv2_ItemClick(ItemID As Long, Position As Int, ClickedPanel As Panel)
'    Log(ItemID)
'  
    Dim pnl_main As Panel = ClickedPanel.GetView(0)
    Dim btn_up As Button = pnl_main.GetView(6)
  
    btn_up.Tag = btn_up
    ToastMessageShow(btn_up.Tag, True)
  
    Dim lbl_counter As Label = pnl_main.GetView(5)
'btn_up.Tag = clv2.
'ToastMessageShow(ItemID, True)

    'if counting = 1 Then
'        opo = lbl_counter.Text
'        ToastMessageShow(opo, True)
'        lbl_counter.Text = opo +1
'        counting = 0
    'End If
'    counting = lbl_counter
    'Log(btn_up.)
  
    'ToastMessageShow( clv2.GetItemID(Position), True)
End Sub

Sub clv2_ItemSelectedStateChanged(ItemID As Long, Position As Int, Selected As Boolean)
    'Log("SelectionChanged ID=" & ItemID & ", Pos=" & Position & ", Selected=" & Selected)
  
  
End Sub





Sub btn_up_Click
'Dim Index As String = Sender
'Log("Index: " & Index)

Dim b As Button = Sender
ToastMessageShow(b, True)
'Log("Button: " & b)
'ToastMessageShow(counting, True)
'Dim btn_up As Button = Sender
'Dim ID As Int =  btn_up.Tag
'ToastMessageShow(ID, True)
  
  

    counting = 1
End Sub
End Sub

I load a Layout from the designer, on this layout are the labels and buttons.


If i press "btn_up" should on "lbl_counter" +1
I have no idea, because I do not know how I get the ID of the button in the "btn_click" event to then change the label.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…