Trouble with marking and selecting the list view
<p>In my application I am having a list view,Now the problem is I want to get the marked positions 
the code I am using is</p>

<pre><code>        @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
            System.out.println("Entered Delete Button");
                String selected = "";
                int cntChoice = lv.getCount();
                System.out.println("The Number Of Contacts"+cntChoice);
                SparseBooleanArray x = lv.getCheckedItemPositions();
                System.out.println(x);
                for(int i = 0; i &lt; cntChoice; i++){
                    if(x.get(i)) {
                        selected += lv.getItemAtPosition(i).toString() + "\n";  

                    }
                }   
                Toast.makeText(ViewSelectedContacts.this, 
                        selected, 
                        Toast.LENGTH_LONG).show();
            }
        });
</code></pre>

<p>The problem is SparseBooleanArray is not populating with the element
Also i had added </p>

<pre><code>    android:choiceMode="multipleChoice"
</code></pre>

<p>in the listview..Somebody please help me to fin the problem    </p>
