private void toggleSelection(final int position){
  mTicketsAdapter.toggleSelection(position);
  int count=mTicketsAdapter.getSelectedItemCount();
  if (count == 0) {
    mActionMode.finish();
  }
 else {
    mActionMode.setTitle(String.valueOf(count));
    mActionMode.invalidate();
  }
}

private void toggleSelection ( final int position ) { mTicketsAdapter . toggleSelection ( position ) ; int count = mTicketsAdapter . getSelectedItemCount ( ) ; if ( count == 0 ) { mActionMode . finish ( ) ; } else { mActionMode . setTitle ( String . valueOf ( count ) ) ; mActionMode . invalidate ( ) ; } }
toggle the selection state of an item . < p / > if the item was the last one in the selection and is unselected , the selection is stopped . note that the selection must already be started ( mactionmode must not be null ) .
