Code example for SparseIntArray

Methods: get, put

0
		boolean exist = checkedIds.remove(serverId);
		Log.d(TAG, "toggleChecked exist = " + exist);
		if (!exist) {
			checkedIds.add(serverId);
		} 
		int count = checkedCount.get(groupPosition, 0);
		Log.d(TAG, "toggleChecked count = " + count);
		count += exist ? -1 : 1;
		checkedCount.put(groupPosition, count);
 
		checkOthersGroups(groupPosition, exist, serverId);
 
		notifySelectionListener(); 
		notifyDataSetChanged(false);
		// we need to also update the group view 
		// ((CheckedTextView)v.findViewById(R.id.checkBox)).setChecked(!exist); 
	} 
 
	public String[] getCheckedIds() {
		Log.d(TAG, "getCheckedIds");
		return checkedIds.toArray(new String[checkedIds.size()]);