title: How can I update my Listview from a Delete button in my custom row?
body: <p>I have built a custom row for my ListView which shows the contents of the users Cart. I've added a Button so that they can delete any row they want to. The code for the start of my adapter is below.</p>
  
  <pre><code>public class CartDetailAdapter extends ArrayAdapter&lt;CartDetail&gt; {
      Context context;
      int layoutResourceId;
      CartDetail data[] = null;
  
      public CartDetailAdapter(Context context, int layoutResourceId, CartDetail[] data) {
          super(context, layoutResourceId, data);
          this.layoutResourceId = layoutResourceId;
          this.context = context;
          this.data = data;
      }
  </code></pre>
  
  <p>You can see that my data is of type CartDetail which is a class which lists all the items in my custom row. The code I've set out for my removeBttn is set out in getView().</p>
  
  <pre><code>holder.removeBttn = (Button)row.findViewById(R.id.removeBttn);
  holder.removeBttn.setTag(position);
  
  holder.removeBttn.setOnClickListener(new View.OnClickListener() {
      public void onClick(View v) {
          Integer index = (Integer) finalHolder.removeBttn.getTag();
          data.remove(index.intValue());
          notifyDataSetChanged();
      }
  });
  </code></pre>
  
  <p>As my data variable is of type CartDetail[] and not ArrayList, I cannot use remove to delete the item from my list. How can I remove an item from CartDetail[], do I need to create my own method?</p>