Android Question check custom listview items visibility

KZero

Active Member
Licensed User
Longtime User
Hello,

i have custom listview with so many items

how to know which items are visible on screen now and which items are offscreen

i want to know that to reduce the memory usage by freeing up the Bitmaps from each offscreen item

thanks
 

eurojam

Well-Known Member
Licensed User
Longtime User
Kzero,
may be you can extend the CustomListView Class with a Scrollposition - feature. The CustomListView is based on a Scrollview which has this feature. You have to insert something like this in the class module:
B4X:
Public Sub GetScrollposition As Int
  Return sv.ScrollPosition
End Sub

Hope this helps
stefan
 
Upvote 0

KZero

Active Member
Licensed User
Longtime User
Kzero,
may be you can extend the CustomListView Class with a Scrollposition - feature. The CustomListView is based on a Scrollview which has this feature. You have to insert something like this in the class module:
B4X:
Public Sub GetScrollposition As Int
  Return sv.ScrollPosition
End Sub

Hope this helps
stefan

this is a good idea but what about if i have variant item heights ?
 
Upvote 0

eurojam

Well-Known Member
Licensed User
Longtime User
just an idea: you can loop through your panels from the beginning of your listview and add the panelheights. If your sum is less then your scrollpos they will be unvisible....and the same for the end of your list

stefan
 
Upvote 0
Top