title: Emoji keyboard crashing
body: <p>I'm a fairly new developer, so please go easy on me.</p>
  <p>I'm making a chat app, and I'm planning on adding support for custom emojis, similar to how Discord manages custom emojis. However, my app is crashing once I tap on the emoji button. I want it to inflate my layout (emoji_keyboard_layout.xml) and view that in a LinearLayout in ChatActivity.</p>
  <p>I've tried adding the view itself to the layout <em>(yeah that didn't work in my case, but if that is the only solution possible, then I will try it again)</em> and I've also tried modifying my onClick, modifying the actual method, but whatever I did, nothing would fix it.</p>
  <p>My openEmojiKeyboard method:</p>
  <pre><code>private void openEmojiKeyboard(Boolean EMOJI_STATE, Boolean GIF_STATE)
  {
      View emojiKey = getLayoutInflater().inflate(R.layout.emoji_keyboard_layout, llEmojiKeyboard);
  
      llEmojiKeyboard.addView(emojiKey);
      llEmojiKeyboard.setVisibility(View.VISIBLE);
  
      hideKeyboard(etMessage);
  
      final LinearLayout llSelectContent = emojiKey.findViewById(R.id.llSelectContent);
      final LinearLayout llSelectToolbar = emojiKey.findViewById(R.id.llSelectToolbar);
      final LinearLayout llEmoji = emojiKey.findViewById(R.id.llEmoji);
      final LinearLayout llGif = emojiKey.findViewById(R.id.llGif);
  
      final LinearLayout llEmojiSelected = emojiKey.findViewById(R.id.llEmojiSelected);
      final LinearLayout llGifSelected = emojiKey.findViewById(R.id.llGifSelected);
  
      final TextView tvEmptyContent = emojiKey.findViewById(R.id.tvEmptyContent);
      final TextView tvEmptyContent1 = emojiKey.findViewById(R.id.tvEmptyContent1);
  
      if (EMOJI_STATE &amp;&amp; !GIF_STATE) // The emoji keyboard is open, gif keyboard is closed
      {
          llEmojiSelected.setVisibility(View.VISIBLE);
          llGifSelected.setVisibility(View.GONE);
  
          tvEmptyContent1.setText(R.string.add_emoji);
          tvEmptyContent.setText(R.string.empty_emoji_content);
      }
      else if (GIF_STATE &amp;&amp; !EMOJI_STATE) // The gif keyboard is open, emoji keyboard is closed
      {
          llGifSelected.setVisibility(View.VISIBLE);
          llEmojiSelected.setVisibility(View.GONE);
  
          tvEmptyContent1.setText(R.string.retry);
          tvEmptyContent.setText(R.string.empty_gif_content);
      }
  }
  </code></pre>
  <p>My activity's onClick event:</p>
  <pre><code>case R.id.ivEmoji:
              openEmojiKeyboard(EMOJI_STATE, GIF_STATE);
              break;
  </code></pre>
  <p><strong>The emoji keyboard functionality is not ready yet, just preparing the layout</strong></p>
  <p><strong>Stack Trace</strong></p>
  <pre><code>java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
  </code></pre>
  <p>Crashing on lines <code>llEmojiKeyboard.addView(emojiKey);</code> and <code>openEmojiKeyboard(EMOJI_STATE, GIF_STATE);</code></p>