Android Question check custom listview items visibility

Discussion in 'Android Questions' started by KZero, Feb 16, 2015.

  1. KZero

    KZero Active Member Licensed User


    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

  2. eurojam

    eurojam Well-Known Member Licensed User

    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:
    Public Sub GetScrollposition As Int
    Return sv.ScrollPosition
    End Sub
    Hope this helps
    KZero likes this.
  3. KZero

    KZero Active Member Licensed User

    this is a good idea but what about if i have variant item heights ?
  4. eurojam

    eurojam Well-Known Member Licensed 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

    KZero likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice