title: Move checked item into expandable list view
body: <p>I'm facing with a big problem with the ExpandableListView.
  My goal is to let user change item's position into this single selection expandable list view:</p>
  
  <p><img src="https://i.stack.imgur.com/QH9Yq.png" alt="enter image description here"></p>
  
  <p>When an user clicks on an item, the item becomes checked and a context action bar appears. 
  So user can move up or down an item in this way:</p>
  
  <p><img src="https://i.stack.imgur.com/4X4ZF.png" alt="enter image description here"></p>
  
  <p>The move up/down function that i've implemented works fine (it's based on swap position over an ArrayList, that's the datasource of my BaseExpandableListAdapter, and notify changes to the UI). Unfortunately when i move a checked item, it looses the checked state...and if i move the item out of the visible bounds (in the example, after "Locked" or before "Attachements" view) the expandablelistview doesn't scroll to the new position.</p>
  
  <p>How can i achieve that?</p>
  
  <p>Below, my "moveDownFocusedItem()" coded into my custom Adapter class:</p>
  
  <pre><code> //This class is ok!
   //Contains Group and Child position of an ExpandableListView
   public class Position{
      int GroupPosition;
      int ChildPosition;
  
      public boolean isChild(){
          return (ChildPosition != AbsListView.INVALID_POSITION);
      }
  
  
      public Position getPreviousPosition(){
          if(ChildPosition==AbsListView.INVALID_POSITION)
              if(GroupPosition&gt;0)
                  return new Position(GroupPosition-1);
              else
                  return null;
          else
              if(ChildPosition&gt;0)
                  return new Position(GroupPosition, ChildPosition-1);
              else
                  return null;
      }
  
  
      public Position getNextPosition(){
          if(ChildPosition==AbsListView.INVALID_POSITION)
              if(GroupPosition&lt;_fieldConfigurationList.size()-1)
                  return new Position(GroupPosition+1);
              else
                  return null;
          else
                if(ChildPosition&lt;_fieldConfigurationList.get(GroupPosition).getChildren().size()-1)
                  return new Position(GroupPosition, ChildPosition+1);
              else
                  return null;
      }
  
      public Position(int groupPosition){
          this.GroupPosition = groupPosition;
          this.ChildPosition = AbsListView.INVALID_POSITION;
      }
  
      public Position(int groupPosition, int childPosition){
          this.GroupPosition = groupPosition;
          this.ChildPosition = childPosition;
      }
  }
  
  
  public void moveDownFocusedItem(){
  
      //This function returns the next position to move to 
      //(_focusedPosition is the current checked item position)
      Position nextPosition = this._focusedPosition.getNextPosition();
  
      //Swap ArrayList (This works!)
      if(nextPosition!=null){ 
          Collections.swap(this._fieldConfigurationList,  //that's my datasource
                           this._focusedPosition.GroupPosition,  //Start position for swapping
                           nextPosition.GroupPosition);   //Destination position for swapping
  
      //Set the new focused position (This works!)
      this._focusedPosition = nextPosition;
  
      //TODO:
      //Now i have to call "SetItemChecked()" method to uncheck old focused position and check the new one.
      //How to do it? How can i get the required "position" argument from _focusedPosition.GroupPosition and _focusedPosition.ChildPosition?
      //And also...if the focused view has moved to an invisible position (such as the end of the expandablelistview) how can i scroll 
      //to this position?
  
      //Notify changes (This works!)
      this.notifyDataSetChanged();
  
      }
  }
  </code></pre>