title: How to get the count of Listview item selection in Android
body: <p>I have a <code>ListView</code> which am setting that to my adapter. The <code>ListView</code> item contains two view elements which are <code>chekbox</code> and <code>TextView</code>.</p>
  
  <p>I have given the <code>setChoiceMode(ListView.CHOICE_MODE_MULTIPLE)</code> for the <code>ListView</code>.</p>
  
  <p>When i want to select one or more element, I want to get the count (based on selecting and deselecting).</p>
  
  <p>I can't do this stuff in <code>onItemClickListener</code> of <code>ListView</code>. </p>
  
  <p>So I have written the logic in BaseAdapter.</p>
  
  <pre><code>holder.check.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              count += 1;
          }
      });
  </code></pre>
  
  <p>But If i deselect the item then the value have to decrease. If iam having only one item in <code>ListView</code> then I can write </p>
  
  <pre><code>SparseBooleanArray checked = listView.getCheckedItemPositions();
  </code></pre>
  
  <p>and get the value in Fragment. Just I get confused. Could someone help me?</p>