Code example for SparseBooleanArray

Methods: put

0
			break; 
		case CHOICE_MODE_SINGLE_PER_GROUP:
			SparseBooleanArray checkedChildPositionsSingle = checkedPositions.get(groupPosition);
			// If in the group there was not any child checked 
			if (checkedChildPositionsSingle == null) {
				checkedChildPositionsSingle = new SparseBooleanArray();
				// By default, the status of a child is not checked 
				checkedChildPositionsSingle.put(childPosition, true);
				checkedPositions.put(groupPosition, checkedChildPositionsSingle);
			} else { 
				boolean oldState = checkedChildPositionsSingle.get(childPosition);
				// If the old state was false, set it as the unique one which is true 
				if (!oldState) {
					checkedChildPositionsSingle.clear();
					checkedChildPositionsSingle.put(childPosition, !oldState);
				} // Else does not allow the user to uncheck it 
			} 
			break; 
		// This mode will remove all the checked positions from other groups 
		// and enable just one from the selected group 
		case CHOICE_MODE_SINGLE_ABSOLUTE: