Code example for ExpandableListView

Methods: getChildAt, getFirstVisiblePosition, getLastVisiblePosition

0
  /** 
   * @param list 
   * @param flatPosition 
   */ 
  void selectCurrent(ExpandableListView list, int flatPosition) {
    if (flatPosition >= list.getFirstVisiblePosition() && flatPosition <= list.getLastVisiblePosition()) {
      View view = list.getChildAt(flatPosition - list.getFirstVisiblePosition());
      if (view != null && view instanceof ListItemView) {
        ListItemView itemView = (ListItemView) view;
        itemView.setCurrent(true);
      } 
    } 
  } 
 
  /** 
   * remove any current selected items 
   */ 
  void selectNone(ExpandableListView list) {
    for (int index = 0; index <= list.getLastVisiblePosition() - list.getFirstVisiblePosition(); ++index) {
      View view = list.getChildAt(index);
      if (view != null && view instanceof ListItemView) {