Code example for Vector

Methods: add, contains, removeElement

0
     * Handles click on checkbox for a list item. 
     * @param chkBox Checkbox view 
     * @param id Id assigned to the list item 
     */ 
    protected void toggleCheck(CheckBox chkBox, int id) {
        if (mSelectedItems.contains(id)) {
            mSelectedItems.removeElement(id);
        } else { 
            mSelectedItems.add(id);
        } 
        chkBox.setChecked(mSelectedItems.contains(id));
    } 
 
    /** 
     * Returns the ids of the selected list items. 
     * @return List of ids of selected list items. 
     */ 
    public Vector<Integer> getSelectedItems() {
        return mSelectedItems;
    }