I want to show the page when all items are loaded into the CLV to avoid the list flickering, but in this case CLV.JumpToItem doesn't work. Is that normal or its a bug?
B4XMainPage:
HomePage.Initialize
B4XPages.AddPage("Home", HomePage)
ChatPage.Initialize
B4XPages.AddPageAndCreate("Chat", ChatPage)
HomePage:
Sub CustomListView1_ItemClick (Index As Int, Value As Object)
B4XPages.MainPage.ChatPage.UpdateMessages(Value)
End Sub
ChatPage:
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