title: How to add an empty row to GridView programmatically:
body: <p>I know this question have been asked a few times, and I know that what you will say is that the GridView as with the ListView object is also backed up by an adapter implementation that should populate the rows of the grid.</p>
  
  <p><strong>My requirement is as follows:</strong> I have a gridview of emoticons, that are displayed when I press on one of the buttons on the keyboard I develop. As part of this emoticons gridview I have a view of buttons at the bottom of it to allow the user to continue working with the keyboard (buttons like space, delete, go back to regular keyboard and others...)</p>
  
  <p><strong>Now I want to add an empty row to the gridview so I can allow the user to choose the emoticons on the last row of the grid</strong> (If I won't add this row the last row of the gird view is behind the additional buttons view and can't be selected) Here is an example:</p>
  
  <p><img src="https://i.stack.imgur.com/mGF2G.png" alt="Emoticons keyboard screenshot"></p>
  
  <p>As you can see here the last row is behind the additional buttons view and can't be pressed. I can't just add an arbitrary number of empty icons to the gridview as the number of icons in a row is changing when moving from one device to another.</p>
  
  <p>So the question is how can I add an empty row to this gridview with no regards to the number of items in the row?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public class EmojiconGridView{
  public View rootView;
  EmojiconsPopup mEmojiconPopup;
  EmojiconRecents mRecents;
  Emojicon[] mData;
  
  public EmojiconGridView(Context context, Emojicon[] emojicons, EmojiconRecents recents, EmojiconsPopup emojiconPopup) {
      LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
      mEmojiconPopup = emojiconPopup;
      rootView = inflater.inflate(R.layout.emojicon_grid, null);
      setRecents(recents);
       GridView gridView = (GridView) rootView.findViewById(R.id.Emoji_GridView);
          if (emojicons== null) {
              mData = People.DATA;
          } else {
              Object[] o = (Object[]) emojicons;
              mData = Arrays.asList(o).toArray(new Emojicon[o.length]);
          }
          EmojiAdapter mAdapter = new EmojiAdapter(rootView.getContext(), mData);
          mAdapter.setEmojiClickListener(new OnEmojiconClickedListener() {
  
              @Override
              public void onEmojiconClicked(Emojicon emojicon) {
                  if (mEmojiconPopup.onEmojiconClickedListener != null) {
                      mEmojiconPopup.onEmojiconClickedListener.onEmojiconClicked(emojicon);
                  }
                  if (mRecents != null) {
                      mRecents.addRecentEmoji(rootView.getContext(), emojicon);
                  }
              }
          });
          gridView.setAdapter(mAdapter);
          View newEmpryView = new View(context);
          gridView.addView(newEmpryView);
  
  }
  
  private void setRecents(EmojiconRecents recents) {
      mRecents = recents;
  }
  
  public interface OnEmojiconClickedListener {
      void onEmojiconClicked(Emojicon emojicon);
  } 
  </code></pre>
  
  <p>}</p>
  
  <p>Clearly the row:</p>
  
  <pre><code> gridView.addView(newEmpryView);
  </code></pre>
  
  <p>gives me an exception of: : <code>addView(View) is not supported in AdapterView</code>, So how can this be accomplished? Thanks.</p>