how to remove item in listview using button inside the arrayadapter
<p>Im trying to remove an item displayed in my <code>ListView</code> using a button inside my <code>ArrayAdapter</code>. I saw <code>getPosition</code> method in the <code>ArrayAdapter</code> that returns the index number of the item, but I dont know to use it in the remove method of the <code>ArrayAdapter</code>. How can I do this? need help please.</p>

<p>arrayAdapter</p>

<pre><code>public class myOrderAdapter extends ArrayAdapter&lt;myOrder&gt; {


ArrayList&lt;myOrder&gt; list;

    public class ViewHolder{
        TextView tableNum;
        TextView itemName;
        TextView itemQuantity;
        TextView custName;
        Button btnStatus;
    }

    public myOrderAdapter(Context context, ArrayList&lt;myOrder&gt; orderList) {
        super(context, 0,orderList);
        this.list = orderList;
    }

    @Override
        public View getView(final int position, View convertView, ViewGroup parent) {

            final myOrder orderList = getItem(position);

            ViewHolder viewHolder;
            viewHolder = new ViewHolder();
            if(convertView == null){


                convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_layout,parent,false);

                viewHolder.tableNum = (TextView)convertView.findViewById(R.id.tableNum);
                viewHolder.itemName = (TextView)convertView.findViewById(R.id.itemName);
                viewHolder.custName = (TextView)convertView.findViewById(R.id.custName);
                viewHolder.itemQuantity = (TextView)convertView.findViewById(R.id.itemQuantity);
                viewHolder.btnStatus = (Button)convertView.findViewById(R.id.statusButton);

                convertView.setTag(viewHolder);
            }

            else {
                viewHolder = (ViewHolder)convertView.getTag();
            }


            viewHolder.tableNum.setText("Order for Table: "+orderList.getTable_id());
            viewHolder.itemName.setText(orderList.getItem_name());
            viewHolder.custName.setText("Customer Name: " + orderList.getCust_name());
            viewHolder.itemQuantity.setText("QTY: " + orderList.getQuantity());


            if(orderList.getStatus_id() == 1){
                viewHolder.btnStatus.setText("Ready");
                viewHolder.btnStatus.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Toast.makeText(getContext(),"" + getPosition(orderList),Toast.LENGTH_SHORT).show();
                                // Remove item codes here..
                                list.remove(position);

                    }
                });
                notifyDataSetChanged();
            }

            return convertView;
        }
</code></pre>