Android Question VB4A Listview, how to obtain de then second line value

Cableguy

Expert
Licensed User
Longtime User
Now for your question...
Possible, yes, but without any other info, like a code snippet on how you populated your list view, there's not much else we can tell you.
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
Upvote 0

Ramon Bustamante

Member
Licensed User
Now for your question...
Possible, yes, but without any other info, like a code snippet on how you populated your list view, there's not much else we can tell you.
Now for your question...
Possible, yes, but without any other info, like a code snippet on how you populated your list view, there's not much else we can tell you.
This is the sample code:
#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: ListView example
#VersionCode: 1
#VersionName:

#End Region

Sub Process_Globals

End Sub

Sub Globals
Dim ListView1 As ListView
End Sub

Sub Activity_Create(FirstTime As Boolean)
ListView1.Initialize("ListView1")
Dim GD As GradientDrawable
GD.Initialize("TR_BL", Array As Int(Colors.Gray, Colors.LightGray))
Activity.Background = GD
ListView1.ScrollingBackgroundColor = Colors.Transparent
Dim Bitmap1 As Bitmap
Bitmap1.Initialize(File.DirAssets, "button.gif")

ListView1.SingleLineLayout.ItemHeight = 100dip
ListView1.SingleLineLayout.Label.TextSize = 20
ListView1.SingleLineLayout.Label.TextColor = Colors.Blue
ListView1.SingleLineLayout.Label.Gravity = Gravity.CENTER
ListView1.FastScrollEnabled = True
For i = 1 To 500
ListView1.AddSingleLine("Item #" & i)
ListView1.AddTwoLines("Item #" & i, "This is the second line.")
ListView1.AddTwoLinesAndBitmap("Item #" & i, "This is the second line.", Bitmap1)
Next
Activity.AddView(ListView1, 0, 0, 100%x, 100%y)
End Sub
Sub ListView1_ItemClick (Position As Int, Value As Object)
Activity.Title = Value

End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


In ListView1_ItemClick I obtain the value of the first line row and the question but I don't see the way to obtain the second's line value.

Thanks
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Hi, please have a look at the ListView object definition here.
Using AddSingleLine2 you will be able to set the return Value read back through ItemClick (and GetItem too).
The same applies for the other "bis" functions.
 
Upvote 0

Ramon Bustamante

Member
Licensed User
Hi, please have a look at the ListView object definition here.
Using AddSingleLine2 you will be able to set the return Value read back through ItemClick (and GetItem too).
The same applies for the other "bis" functions.
Solved, with AddTwoLines2, saying texto2 at the end. In ItemClick event I obtain texto2 value.
Thanks.

For i = 1 To 500
ListView1.AddSingleLine("Item #" & i)
Dim texto2 As String="Segunda linea " & i
ListView1.AddTwoLines2("Item #" & i, texto2,texto2)
Next
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
This is the international part of the forum, so you should stick to using English.
My corrections, even if you don't like them, are meant for your improvement.
When posting code, use code tags so that the code becomes more readable.
Also, when asking for help, simply describing the issue in 2 lines is rarely enough to, so whenever possible, add some code that describes the issue, or the error logs if any.
Get the name of the product right, the product is called B4A, formerly known as Basic4Android. Although in its description, EREL says it's a "VB like syntax", he never referred to the product as Visual Basic 4 Android.
Once again, this is not a personal attack, but simple corrections and suggestions for a better user experience. I also strongly recommend that you read Klaus beginners guides, as they answer about 80% of the most commonly posted questions.
 
Upvote 0
Top