Android Question CustomListView - Clear Selection?

Discussion in 'Android Questions' started by aregan, Aug 15, 2019.

  1. aregan

    aregan Member Licensed User


    I'm using a CustomListView to allow select / navigate to a record.
    We've set the CustomListView.PressedColor to a light blue to highlight the selection and give the user feedback.

    When an item on the CustomListView is pressed a call is made to service which then causes a new activity to be shown, however when they return to prevous Activity with the CustomListView the selected item is still the PressedColor, and every other item thats pressed also is set to the PressedColor.

    So, without calling the CLEAR method and loading the CustomListView, how can we unselect or clear the selection so that the ListView panel items background color is restored to normal
  2. mangojack

    mangojack Well-Known Member Licensed User

    Normally the clv pressed color is only a temporary event ... have you coded to change the item panel color for the selected item ?

    anyway .. knowing the index of selected item , you could reset selection of item prior to loading new activity.
    CustomListView.GetPanel(Index).Color = Colors.White
    but you also mention ...
    So you might need to loop thru the CLV and apply that code to all items.
  3. Erel

    Erel Administrator Staff Member Licensed User

    Two options:
    1. Add Sleep(250) before you start the next activity.
    2. Set the pressed color to transparent and handle the selection color yourself in ItemClick event.
    mangojack 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