title: How to make same row invisible on clicking button in custom adapter?
body: <p><a href="http://i.stack.imgur.com/ZWgD3.png" rel="nofollow">I have a delete button in my row, and while clicking it i want to make the current layout to be replaced by another which i have made gone in my xml class. But my problem is only the last row is getting replaced.</a></p>
  
  <pre><code>public class CustomGroupListAdapter extends BaseAdapter {
  
  
  
      private Activity activity               =   null;
      private static LayoutInflater inflater  = null;
      public Resources res                    = null;
      ArrayList&lt;String&gt; data                  = null;
      private String mfruits[];
      ViewHolder holder;
      String[] fruits;
  
  
      boolean isEdit=false;
      CustomGroupListAdapter(Activity a,boolean isEdit, Resources resLocal, String[] fruits){
          this.activity=a;
         // this.data=data1;
          this.res=resLocal;
          this.mfruits=fruits;
          this.isEdit=isEdit;
  
          inflater = ( LayoutInflater )activity.
                  getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
      }
  
      @Override
      public int getCount() {
          return mfruits.length;
      }
  
  
      @Override
      public Object getItem(int position) {
          return null;
      }
  
      @Override
      public long getItemId(int position) {
          return 0;
      }
  
      @Override
      public View getView(final int position, View convertView, ViewGroup parent) {
  
          View vi = convertView;
  
  
          if(convertView==null){
  
              /****** Inflate tabitem.xml file for each row ( Defined below ) *******/
              vi = inflater.inflate(R.layout.list_item_child, null);   //*************************** ACTUAL*******
            //  vi = inflater.inflate(R.layout.addsharepoint_child, null);
  
              /****** View Holder Object to contain tabitem.xml file elements ******/
  
              holder = new ViewHolder();
              holder.txtTitle = (TextView) vi.findViewById(R.id.lblListItem);
              holder.txtTime=(TextView)vi.findViewById(R.id.txttime);
              holder.txtVersion=(TextView)vi.findViewById(R.id.txtversion);
              holder.image=(ImageView)vi.findViewById(R.id.image);
              holder.button=(Button)vi.findViewById(R.id.delete_icon);
              holder.relativeLayout=(RelativeLayout)vi.findViewById(R.id.delete);
  
              if(isEdit){
                  holder.button.setVisibility(View.VISIBLE);
              }else
              {
                  holder.button.setVisibility(View.GONE);
              }
  
              /************  Set holder with LayoutInflater ************/
              vi.setTag( holder );
             // holder.relativeLayout.setTag(holder);
          }
          else
              holder=(ViewHolder)vi.getTag();
  
          holder.txtTitle.setText(mfruits[position]);
  
  
  
  
          ///**************************************Trying for dialog box
  
          holder.button.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
  
                  holder.relativeLayout.setVisibility(View.VISIBLE);
  
              }
          });
  
  
  
  
          return vi;
      }
  
  
  
  
  
      /********* Create a holder Class to contain inflated xml file elements *********/
      public static class ViewHolder{
  
          public TextView txtTitle;
          public TextView txtTime;
          public TextView txtVersion;
          public ImageView image;
          public Button button;
  
          public RelativeLayout relativeLayout;
  
      }
  
  
  }
  </code></pre>