I have three textviews and a button in each row of my listview , on button click i want to remove the paticular row from the listview. I have tried many codes but without any success. Please do help.Thanks in advance!!!
VivzAdapter adapter=new VivzAdapter(this,foodname,quantity,amount);
view.setAdapter(adapter);
view.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view2,
int position, long id) {
int itemPosition = position;}
});
}
}
class VivzAdapter extends ArrayAdapter<String>
{
String[] t;
String[] u;
String[] d;
Context context;
VivzAdapter(Context c,String[] foodname,String [] quantity,String[] amount)
{
super(c,R.layout.listviewcustom,R.id.tv1,foodname);
this.context=c;
this.t=foodname;
this.u=quantity;
this.d=amount;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
LayoutInflater inflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View row=inflater.inflate(R.layout.listviewcustom,parent,false);
TextView t1=(TextView) row.findViewById(R.id.tv1);
TextView t2=(TextView) row.findViewById(R.id.tv2);
TextView t3=(TextView) row.findViewById(R.id.tv3);
Button b=(Button)row.findViewById(R.id.cancelbutton);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
}
});
t1.setText(t[position]);
t2.setText(u[position]);
t3.setText(d[position]);
return row;
}
}