Android Question Which view to use to list data ??

MarcioCC

Member
Licensed User
Longtime User
Good night, which view should I use to list data ??
CustomListView, ListView ??
My app will list more than 5000 items view
Does anyone have any examples of how to use CustomListView with database.
I need to list the fields with the following layout in the ListView or CustomListView
Bar code :
7892364591238
Qty:
4
Can you do that ??
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
CustomListView might be too slow for 5000 items.

If the items are simple enough then you can use ListView:

SS-2017-06-27_09.28.10.png


Example:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   ListView1.SingleLineLayout.ItemHeight = 120dip
   ListView1.SingleLineLayout.Label.Left = 10dip
   Dim cs As CSBuilder
   For i = 1 To 100
     cs.Initialize
     cs.Size(17)
     cs.Color(0xFFC0BFC0).Append("Bar code:").Append(CRLF).Pop
     cs.RelativeSize(0.8).VerticalAlign(10dip).Append("7892364591238").Append(CRLF).Pop.Pop.Append(CRLF)
     cs.Color(0xFFC0BFC0).Append("Qty:").Append(CRLF).Pop
     cs.RelativeSize(0.8).VerticalAlign(10dip).Append(i).Append(CRLF).Pop.Pop
     cs.PopAll
     ListView1.AddSingleLine(cs)
   Next
End Sub
 
Upvote 0
Top