How to add a value to arraylist if none of the checkboxes are selected in a page in android?
<p>I am working on <strong>quiz application</strong>. For each question there are <strong>multiple options</strong> should be selected. For that I have used checkboxes. <strong>When check box is checked I am storing the checked id value in arraylist and if unchecked I am removing that id from the arraylist.</strong> Also before this I am adding the <strong>number of answers</strong> for each question in the arraylist and in the next button click I am adding an "|"(or) symbol to differentiate the questions. </p>

<p>So for example 3 questions are displayed....then my arraylist contains </p>

<p><img src="http://i.stack.imgur.com/LfStL.png" alt="enter image description here"></p>

<p>Now for the first question I selected 3 option, for second question I selected 4 options and for third question I didnt select any of the option. So for third question only the number of correct answers and the | symbol is displayed. <strong>But now my problem if none of the checkboxes are selected I want to pass a value in the arraylist</strong>. How can I do that? Please help me regarding this....Struggling for this since 3 days....</p>

<p>My Code:</p>

<pre><code>cbs[k].setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {

        if (((CheckBox) v).isChecked()) {

            selchkboxlist.add(Integer.toString(v
                    .getId()));

            System.out.println("chkboxlist size"
                    + selchkboxlist.size());

        } 
        else
        {

            selchkboxlist.remove(Integer.toString(v
                    .getId()));
            System.out
                    .println("after delete chkboxlist size"
                            + selchkboxlist.size());
            }

    }
}); 
</code></pre>

<p>Will be thankful in advance</p>
