Unable to delete checked item in android
<p>I have one table names student, where ismarried one of the column. Where i have already did married or not, there are populated first all student, Then i try to marked married student only which has 5 of 25, which has listed Just Like this</p>

<pre><code>String[] fields = new String[] { "substr(name,1,23)",
            "substr(address,1,35)" };
    int[] views = new int[] { R.id.name, R.id.address, };
    cursor = SQDatabase
            .rawQuery(
                    "SELECT _id, substr(name,1,23),substr(address,1,35) FROM student WHERE ismarried=" + 1,
                    null);
    adapter = new SimpleCursorAdapter(this, R.layout.student_list_item,
            cursor, fields, views);
    jokesList.setAdapter(adapter);
</code></pre>

<p><strong>Note:</strong> Here 1 is the married value where is 0 is unmarried. so only 5 student display .</p>

<p>Now, My question , i have checked 3 among 5,and want to delete that 3 student from list not a database. How to get checked item id , i did not understand,</p>

<p>"I culdnot get t that checked item id but this fired</p>

<pre><code>//DBHelper.java
public void removeMarried(int i) {
    myDataBase = this.getWritableDatabase();
    String Query = "UPDATE student SET ismarried=0  WHERE _id = " + i;
    myDataBase.execSQL(Query);

}
</code></pre>

<p>and checked listener</p>

<pre><code>public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    if (buttonView.isChecked()) {
        Log.d(TAG, "Checked item ");
    } else {
        Log.d(TAG, "UnChecked item ");
    }


}
</code></pre>

<p>And Finally on delete click</p>

<pre><code>removeMarried(1);
</code></pre>

<p>Full Code : <a href="http://pastebin.com/Wc5XWvJG" rel="nofollow">http://pastebin.com/Wc5XWvJG</a></p>

<p>Please give me suggestion.</p>
