E Eldo Mathew Member Jan 22, 2023 #1 How to scroll a PCLV to a specific index (last item) on activity create
M Mahares Expert Licensed User Longtime User Jan 22, 2023 #2 Eldo Mathew said: How to scroll a PCLV to a specific index (last item) on activity create Click to expand... B4X: Sleep(0) 'do not forget this line CustomListView1.ScrollToItem(CustomListView1.GetSize-1) 'use name you gave your customlistview variable, not PCLV Upvote 0
Eldo Mathew said: How to scroll a PCLV to a specific index (last item) on activity create Click to expand... B4X: Sleep(0) 'do not forget this line CustomListView1.ScrollToItem(CustomListView1.GetSize-1) 'use name you gave your customlistview variable, not PCLV
E Eldo Mathew Member Jan 23, 2023 #3 Mahares said: B4X: Sleep(0) 'do not forget this line CustomListView1.ScrollToItem(CustomListView1.GetSize-1) 'use name you gave your customlistview variable, not PCLV Click to expand... Thank you Mahares "ArrayIndexOutOfBoundsException: length=0; index=-1", works if sleep(0) changed to sleep(100) Upvote 0
Mahares said: B4X: Sleep(0) 'do not forget this line CustomListView1.ScrollToItem(CustomListView1.GetSize-1) 'use name you gave your customlistview variable, not PCLV Click to expand... Thank you Mahares "ArrayIndexOutOfBoundsException: length=0; index=-1", works if sleep(0) changed to sleep(100)
Sagenut Expert Licensed User Longtime User Jan 23, 2023 #4 Eldo Mathew said: Thank you Mahares "ArrayIndexOutOfBoundsException: length=0; index=-1", works if sleep(0) changed to sleep(100) Click to expand... It looks that you tried with an empty CLV. B4X: if CustomListView1.GetSize > 0 then CustomListView1.ScrollToItem(CustomListView1.GetSize-1) Upvote 0
Eldo Mathew said: Thank you Mahares "ArrayIndexOutOfBoundsException: length=0; index=-1", works if sleep(0) changed to sleep(100) Click to expand... It looks that you tried with an empty CLV. B4X: if CustomListView1.GetSize > 0 then CustomListView1.ScrollToItem(CustomListView1.GetSize-1)
E Eldo Mathew Member Jan 23, 2023 #5 Sagenut said: It looks that you tried with an empty CLV. B4X: if CustomListView1.GetSize > 0 then CustomListView1.ScrollToItem(CustomListView1.GetSize-1) Click to expand... code is at the end of activity _create. Works if sleep(0) changed to sleep(100) Upvote 0
Sagenut said: It looks that you tried with an empty CLV. B4X: if CustomListView1.GetSize > 0 then CustomListView1.ScrollToItem(CustomListView1.GetSize-1) Click to expand... code is at the end of activity _create. Works if sleep(0) changed to sleep(100)
Sagenut Expert Licensed User Longtime User Jan 23, 2023 #6 Better to have all the code outside the Activity_Create sub. Move the code outside and just call it at the end of Activity_Create Example B4X: Private Sub FillCLV 'Fill the CLV Sleep(0) 'Scroll to last item End Sub Call it from Activity_Create B4X: FillCLV Upvote 0
Better to have all the code outside the Activity_Create sub. Move the code outside and just call it at the end of Activity_Create Example B4X: Private Sub FillCLV 'Fill the CLV Sleep(0) 'Scroll to last item End Sub Call it from Activity_Create B4X: FillCLV