I have an Android app developed with B4A.
I am currently porting this app over to iOS with B4i.
My B4A app uses a 2 column ListView as follows:
Create the ListView:
Populate the List View from a local SQLite database:
Sorry for the "long-winded" explanation above, but how can I implement the same in B4i?
I have looked at CustomListView class and iTableView library, but can't seem to workout how to implement my original B4A code.
I am currently porting this app over to iOS with B4i.
My B4A app uses a 2 column ListView as follows:
Create the ListView:
B4X:
lstQuerySP1.TwoLinesLayout.ItemHeight = 25dip
lstQuerySP1.TwoLinesLayout.Label.Top = 0
lstQuerySP1.TwoLinesLayout.Label.Left = 0
lstQuerySP1.TwoLinesLayout.Label.Width = 60%x
lstQuerySP1.TwoLinesLayout.Label.Height = 28dip
lstQuerySP1.TwoLinesLayout.Label.Gravity = Gravity.CENTER_VERTICAL
lstQuerySP1.TwoLinesLayout.Label.Color = Colors.white
lstQuerySP1.TwoLinesLayout.Label.TextColor = Colors.Black
lstQuerySP1.TwoLinesLayout.Label.TextSize = 10
lstQuerySP1.TwoLinesLayout.SecondLabel.Top = 0
lstQuerySP1.TwoLinesLayout.SecondLabel.Left = 60%x
lstQuerySP1.TwoLinesLayout.SecondLabel.Width = 40%x
lstQuerySP1.TwoLinesLayout.SecondLabel.Height = 28dip
lstQuerySP1.TwoLinesLayout.SecondLabel.Gravity = Gravity.CENTER_VERTICAL
lstQuerySP1.TwoLinesLayout.SecondLabel.Color = Colors.white
lstQuerySP1.TwoLinesLayout.SecondLabel.TextColor = Colors.Black
lstQuerySP1.TwoLinesLayout.SecondLabel.TextSize = 10
Populate the List View from a local SQLite database:
B4X:
Sub ShowSalesBasketSummary
Dim cursor1 As Cursor
Dim txt As String
lstQuerySP1.clear
txt = "SELECT [Todays Sales] AS TOTALSALES, [Number Of Items Bought] AS NUMITEMSSOLD, [Number Of Sales] AS NUMOFSALES, [Average Basket Total] AS AVBASKETTOT, [Items Per Basket] AS BASKETITEMS, [Total Cost] AS TOTALCOST, [Gross Profit %] AS GP, [My Price Conversion Rate] AS PCRATE, [Foot Count %] AS FOOTCOUNT FROM tableSP1"
cursor1=SQL1.ExecQuery(txt)
For i=0 To cursor1.RowCount-1
cursor1.Position=i
Dim MY_TOTALCOST As String = NumberFormat2(cursor1.GetDouble("TOTALCOST"), 1,2, 2,True)
Dim MY_NUMOFSALES As String = NumberFormat2(cursor1.GetDouble("NUMOFSALES"), 1,2, 0,True)
Dim MY_NUMITEMSSOLD As String = NumberFormat2(cursor1.GetDouble("NUMITEMSSOLD"), 1,2, 0,True)
Dim MY_TOTALSALES As String = NumberFormat2(cursor1.GetDouble("TOTALSALES"), 1,2, 2,True)
Dim MY_AVBASKETTOT As String = NumberFormat2(cursor1.GetDouble("AVBASKETTOT"), 1,2, 2,True)
Dim MY_BASKETITEMS As String = NumberFormat2(cursor1.GetDouble("BASKETITEMS"), 1,2, 2,True)
Dim MY_GP As String = NumberFormat2(cursor1.GetDouble("GP"), 1,2, 2,True)
Dim MY_PCRATE As String = NumberFormat2(cursor1.GetDouble("PCRATE"), 1,2, 2,True)
Dim MY_FOOTCOUNT As String = NumberFormat2(cursor1.GetDouble("FOOTCOUNT"), 1,2, 2,True)
lstQuerySP1.Clear
lstQuerySP1.AddTwoLines(" Total Sales" , MY_TOTALSALES)
lstQuerySP1.AddTwoLines(" Number Of Sales" , MY_NUMOFSALES)
lstQuerySP1.AddTwoLines(" Number Of Units Sold" , MY_NUMITEMSSOLD)
lstQuerySP1.AddTwoLines(" Average Sales per Basket" , MY_AVBASKETTOT)
lstQuerySP1.AddTwoLines(" Average Items per Basket" , MY_BASKETITEMS)
lstQuerySP1.AddTwoLines(" Total Cost of Sales" , MY_TOTALCOST)
lstQuerySP1.AddTwoLines(" Gross Profit %" , MY_GP)
lstQuerySP1.AddTwoLines(" My Price Conversion Rate" , MY_PCRATE)
lstQuerySP1.AddTwoLines(" Foot Count %" , MY_FOOTCOUNT)
Next
End Sub
Sorry for the "long-winded" explanation above, but how can I implement the same in B4i?
I have looked at CustomListView class and iTableView library, but can't seem to workout how to implement my original B4A code.