Code example for SparseIntArray

Methods: get, keyAt, size

0
     */ 
    public int getSelectedPosition() { 
        if (mMode != MODE_SINGLE)
            throw new IllegalStateException("Can't obtain selected item position. Not in MODE_SINGLE.");
 
        return aSelectedItems.size() > 0 ? aSelectedItems.get(aSelectedItems.keyAt(0)) : -1;
    } 
 
	/** 
	 * <br/> 
	 * <h5><i>public int[] getSelectedPositions()</i></h5> 
	 * <p> 
	 * Returns the array with positions of currently selected items. 
	 * </p> 
	 * 
	 * @return Array with positions of the currently selected items. Note that 
	 *         this isn't necessary sorted array. 
	 */ 
	public int[] getSelectedPositions() { 
		int[] pos = new int[aSelectedItems.size()];