title: Setting visible to elements that were invisible before in GridView
body: <p>I have a GridView in which I want to always show 7 icons, and sometimes an additional icon depending on a request. In the beginning the additional icon is never shown. This is the structure:</p>
  
  <pre><code>0   1   2
  3   4   5
  6  [7]
  </code></pre>
  
  <p>All the icons fit into the screen so I don't need/have scroll. Each icon is composed by an image and a text.</p>
  
  <p>For this, I have a CustomAdapter which extends BaseAdapter. I have overriden the getView method in which I set the text and the image for each icon.</p>
  
  <pre><code>public View getView(int position, View convertView, ViewGroup parent) {
      View v = null;
  
      if (convertView == null) {
          LayoutInflater li = ((Activity) context).getLayoutInflater();
          v = li.inflate(R.layout.icon, null);
      } else {
          v = convertView;
      }
  
      TextView tv = (TextView) v.findViewById(R.id.icon_textView);
      tv.setText(position);
      ImageView iv = (ImageView) v.findViewById(R.id.icon_ImageView);
      iv.setImageResource(imageResourcesArray[position]);
  
      if ((position == ADDITIONAL_ICON)) &amp;&amp; !showAdditionalIcon) {
          v.setVisibility(View.INVISIBLE);
      }
  
      return v;
  }
  </code></pre>
  
  <p>The <code>imageResourcesArray[]</code> is an array of integers with the image resources.
  The other functions and variables in the CustomAdapter are:</p>
  
  <pre><code>public static final int ADDITIONAL_ICON = 7;
  private boolean showAdditionalIcon = false;
  
  public showAdditionalIcon(){
      this.showAdditionalIcon = true;
      notifyDataSetChanged();
      // notifyDataSetInvalidated();
  }
  
  public hideAdditionalIcon(){
      this.showAdditionalIcon = false;
      notifyDataSetChanged();
      // notifyDataSetInvalidated();
  }
  </code></pre>
  
  <p>Later on, I create and set the CustomAdapter to the GridView from a class which extends Activity (say <code>ClassA</code>):</p>
  
  <pre><code>    GridView grid = (GridView) findViewById(R.id.main_gridView);
      customAdapter = new CustomAdapter(this);
      grid.setAdapter(customAdapter);
  </code></pre>
  
  <p>My problem appears when after some calculations and requests to a server, I have to show the additional icon (number 7). So I call (from <code>ClassA</code>):</p>
  
  <pre><code>    customAdapter.showAdditionalIcon();
  </code></pre>
  
  <p>Now, the additional icon appears, but the first icon disappears... I have tried to use <code>notifyDataSetInvalidated()</code> and <code>notifyDataSetChanged()</code> but both had the same result.</p>
  
  <p>Of course, I could generate a new <code>CustomAdapter</code> with the additional icon allowed, but I would preffer not to do it...</p>
  
  <p>Thanks in advance.</p>