I am getting listview in my layout... I don't know how can I delete multiple items from listview when I select items in checkbox and click delete button. I am adding a piece of code.
public class classname extends Activity implements OnItemSelectedListener {
ListView lv;
ArrayList<x_obj> x_list = new ArrayList<x_obj>();
TextView delete;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_x);
del_txt = (TextView) findViewById(R.id.del_txt);
del_txt.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
"code for delete selected items"
}
});
}
public OrderAdapter(Context context, int row_layout,
ArrayList<x_obj> items) {
super(context, row_layout, items);
this.items = items;
}
@Override
public View getView(final int position, View convertview, ViewGroup parent) {
View v = convertview;
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.row_layout, null);
final x obj = items.get(position);
TextView txt_name = (TextView) v.findViewById(R.id.txt_name);
CheckBox checkBox1=(CheckBox)findViewById(R.id.checkBox1);
return v;
}
}