How to delete a listitem when checkbox is selected?
<p>In my project there is a listview which contains textview and checkbox..Here is my listactivity class:</p>

<pre><code>package com.pack.custom;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class DemolistActivity extends ListActivity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    // Create an array of Strings, that will be put to our ListActivity
    ArrayAdapter&lt;Model&gt; adapter = new MyArrayAdapter(this,
    getModel());
    setListAdapter(adapter);
    }
    private List&lt;Model&gt; getModel() {
    List&lt;Model&gt; list = new ArrayList&lt;Model&gt;();
    list.add(get("Bangladesh"));
    list.add(get("India"));
    list.add(get("China"));
    list.add(get("Japan"));
    list.add(get("Australia"));
    list.add(get("Denmark"));
    list.add(get("Germany"));
    list.add(get("Indonesia"));
    // Initially select one of the items
    list.get(1).setSelected(true);
    return list;
    }
    private Model get(String s) {
    return new Model(s);
    }
}
</code></pre>

<p>And here is myarrayadapter class:</p>

<pre><code>package com.pack.custom;

import java.util.List;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;

public class MyArrayAdapter extends ArrayAdapter&lt;Model&gt; {
    private final List&lt;Model&gt; list;
    private final Activity context;

    public MyArrayAdapter(Activity context, List&lt;Model&gt; list) {
        super(context, R.layout.rowbuttonlayout, list);
        this.context = context;
        this.list = list;
    }

    static class ViewHolder {
        protected TextView text;
        protected CheckBox checkbox;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = null;
        if (convertView == null) {
            LayoutInflater inflator = context.getLayoutInflater();
            view = inflator.inflate(R.layout.rowbuttonlayout, null);
            final ViewHolder viewHolder = new ViewHolder();
            viewHolder.text = (TextView) view.findViewById(R.id.label);
            viewHolder.checkbox = (CheckBox) view.findViewById(R.id.check);
            viewHolder.checkbox
                    .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                        @Override
                        public void onCheckedChanged(CompoundButton buttonView,
                                boolean isChecked) {
                            Model element = (Model) viewHolder.checkbox
                                    .getTag();
                        element.setSelected(buttonView.isChecked());
                        }
                    });
            view.setTag(viewHolder);
            viewHolder.checkbox.setTag(list.get(position));
        } else {
            view = convertView;
            ((ViewHolder) view.getTag()).checkbox.setTag(list.get(position));
        }
        ViewHolder holder = (ViewHolder) view.getTag();
        holder.text.setText(list.get(position).getName());
        holder.checkbox.setChecked(list.get(position).isSelected());
        return view;
    }
}
</code></pre>

<p>Now i want when i select checbox then this specific listitem is deleted.How can i do this?please help</p>

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