i added buttom to my custom listview , and i want to get custom listview item's values as a string when the buttom pressed.
the code are below .
the values are 123 , 456 , 789 .
when the buttom from the first item of customlistview pressed , let toast message box show out "123".
when the buttom from the second item clicked , toast message box show out "456"
how can i make it
please i already search in forum.
i did not fount solution
i just need this on to finish my big project application
help
the code are below .
the values are 123 , 456 , 789 .
when the buttom from the first item of customlistview pressed , let toast message box show out "123".
when the buttom from the second item clicked , toast message box show out "456"
how can i make it
please i already search in forum.
i did not fount solution
i just need this on to finish my big project application
help
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private clv As CustomListView
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Activity.Title = "Single Label with Button"
clv.Initialize(Me, "clv")
clv.AsView.Color = Colors.Transparent
Activity.AddView( clv.AsView, 0, 0, 100%x, 100%y)
clv.Add(addItemWithButton("click here","here"),"123")
clv.Add(addItemWithButton("click here","here"),"456")
clv.Add(addItemWithButton("click here","here"),"789")
End Sub
Sub Activity_Resume
End Sub
Sub clv_ItemClick (Index As Int, Value As Object)
Msgbox(Value , "")
End Sub
Sub btnItemWithButton_Click 'the buttom in custom listview
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
' itemHeight 60dip
Sub addItemWithButton ( itemname As String , btnName As String ) As Panel
Private pbase As Panel
pbase.Initialize("")
pbase.Color = Colors.Transparent
Private lblName As Label
Private btn As Button
lblName.Initialize("")
lblName.Text = itemname
lblName.TextColor = Colors.DarkGray
lblName.Gravity = Gravity.CENTER_VERTICAL
lblName.TextSize = 13
pbase.AddView( lblName, 15dip, 0, 100%x - 135dip, 70dip )
Private sld As StateListDrawable
sld.Initialize
Private c1,c2 As ColorDrawable
c1.Initialize(0xfffe6d6a, 5dip )
c2.Initialize(Colors.DarkGray, 5dip )
sld.AddState(sld.State_Pressed, c2)
sld.AddCatchAllState(c1)
btn.Initialize("btnItemWithButton")
btn.Text = btnName
btn.TextSize = 13
btn.TextColor = Colors.White
btn.Background = sld
pbase.AddView( btn, 100%x - 115dip, 15dip, 100dip, 40dip )
Private divider As Panel
divider.Initialize("")
divider.Color = Colors.ARGB(30, 0,0,0)
pbase.AddView( divider, 15dip, 70dip - 1, 100%x - 30dip, 1 )
Return pbase
End Sub