Sub UpdateMessages (m As Map)
CustomListView1.Clear
' CustomListView1.sv.ScrollViewOffsetY = 0
Private Cursor As Cursor = Starter.SQL.ExecQuery("")
Private Value As Map
For i = 0 To Cursor.RowCount - 1
Cursor.Position = i
Value.Initialize
For c = 0 To Cursor.ColumnCount - 1
Value.Put(Cursor.GetColumnName(c), Cursor.GetString2(c))
Next
Private label As Label
label.Initialize("")
label.TextSize = 15
label.SetLayoutAnimated(0, 0, 0, CustomListView1.AsView.Width - 100dip, 20dip)
Private holder As B4XView = XUI.CreatePanel("")
holder.SetLayoutAnimated(0, 0, 0, CustomListView1.AsView.Width, 40dip + Max(20dip, SU.MeasureMultilineTextHeight(label, Cursor.GetString("message"))) + 15dip)
CustomListView1.Add(holder, Value)
Next
Cursor.Close
If CustomListView1.Size > 0 Then
Sleep(0)
CustomListView1.JumpToItem(CustomListView1.Size - 1)
CustomListView1.Refresh
End If
B4XPages.ShowPage("Chat")
End Sub