@TargetApi(11)
  private static int getMultiSelectListSingleCheckedItemPosition(AbsListView list) {
    Preconditions.checkState(list.getCheckedItemCount() == 1);
    SparseBooleanArray checkedItemPositions = list.getCheckedItemPositions();
    Preconditions.checkState(checkedItemPositions != null);
    for (int i = 0, len = list.getCount(); i < len; i++) {
      boolean itemChecked = checkedItemPositions.get(i);
      if (itemChecked) {
        return i;
      }
    }

    throw new IllegalStateException("No items checked");
  }
Gets the position of the one and only checked item in the provided list in multiple selection
mode.

@return {@code 0}-based position.
@throws IllegalStateException if the list is not in multiple selection mode, or if the number
    of checked items is not {@code 1}.
java/com/google/android/apps/authenticator/AuthenticatorActivity.java