title: Can't show badge at bottomNavigationView
body: <p>I have methods which show badges on some items on my <code>bottomNavigtionView</code>. Here it is:</p>
  
  <pre><code>private fun addBadgeView() {
          val menuView = mainNavigationView.getChildAt(0) as BottomNavigationMenuView
          val itemView = menuView.getChildAt(1) as BottomNavigationItemView
          val notificationBadge = LayoutInflater.from(this).inflate(R.layout.notification_badge, menuView, false)
          val textView = notificationBadge.findViewById&lt;TextView&gt;(R.id.counter_badge)
          val itemView1 = menuView.getChildAt(2) as BottomNavigationItemView
          val notificationBadgeOne = LayoutInflater.from(this).inflate(R.layout.notification_badge, menuView, false)
          val textView1 = notificationBadgeOne.findViewById&lt;TextView&gt;(R.id.counter_badge)
  
          val itemView2 = menuView.getChildAt(3) as BottomNavigationItemView
          val notificationBadge2 = LayoutInflater.from(this).inflate(R.layout.notification_badge, menuView, false)
          val textView2 = notificationBadge2.findViewById&lt;TextView&gt;(R.id.counter_badge)
  
          when {
              sp!!.getInt("notepad_count", 0) &gt; 99 -&gt; textView2.text = resources.getText(R.string.more90)
              sp!!.getInt("notepad_count", 0) &lt; 99 -&gt; textView2.text = sp!!.getInt("notepad_count", 0).toString()
              sp!!.getInt("notepad_count", 0) == 0 -&gt; textView2.visibility = View.GONE
          }
  
          if (sp!!.getString("new_receivedM", "")!!.isNotEmpty()) {
              when {
                  Integer.parseInt(sp!!.getString("new_receivedM", "")!!) &gt; 99 -&gt; textView.text = resources.getText(R.string.more90)
                  sp!!.getString("new_receivedM", "") == "0" -&gt; textView.visibility = View.GONE
                  else -&gt; textView.text = sp!!.getString("new_receivedM", "")
              }
          } else run { textView.visibility = View.GONE }
  
  
          if (sp!!.getString("all_jobs", "")!!.isNotEmpty()) {
              when {
                  Integer.parseInt(sp!!.getString("all_jobs", "")!!) &gt; 99 -&gt; textView1.text = resources.getText(R.string.more90)
                  sp!!.getString("all_jobs", "") == "0" -&gt; textView1.visibility = View.GONE
                  else -&gt; textView1.text = sp!!.getString("all_jobs", "")
              }
          } else {
              textView1.visibility = View.GONE
          }
  
          itemView.addView(notificationBadge)
          itemView1.addView(notificationBadgeOne)
          itemView2.addView(notificationBadge2)
      }
  </code></pre>
  
  <p>but sometimes I would like to remove some items at some conditions, so I have added here small condition:</p>
  
  <pre><code>val set = sp!!.getStringSet("disabled_app_modules", HashSet&lt;String&gt;())
  
  if (set!!.isNotEmpty()) {
     val list: ArrayList&lt;String&gt; = ArrayList()
     list.addAll(set)
     for (i in 0 until list.size) {
      when (list[i].substring(1, list[i].length - 1)) {
  
        "notepad" -&gt; {
           bottomNavigationView.menu.removeItem(R.id.notespec)
         }
       }
   }
  }
  </code></pre>
  
  <p>and I check whether my <code>bottomNavigationView</code> contains this items:</p>
  
  <pre><code>if (bottomNavigationView.getChildAt(2) != null) {
              val itemView1 = menuView.getChildAt(2) as BottomNavigationItemView
              val notificationBadgeOne = LayoutInflater.from(this).inflate(R.layout.notification_badge, menuView, false)
              val textView1 = notificationBadgeOne.findViewById&lt;TextView&gt;(R.id.counter_badge)
  
              if (sp!!.getString("all_jobs", "")!!.isNotEmpty()) {
                  when {
                      Integer.parseInt(sp!!.getString("all_jobs", "")!!) &gt; 99 -&gt; textView1.text = resources.getText(R.string.more90)
                      sp!!.getString("all_jobs", "") == "0" -&gt; textView1.visibility = View.GONE
                      else -&gt; textView1.text = sp!!.getString("all_jobs", "")
                  }
              } else {
                  textView1.visibility = View.GONE
              }
  
              itemView1.addView(notificationBadgeOne)
          }
  </code></pre>
  
  <p>and as a result I don't see any badge because the item is <code>null</code> but it is visible and clickable. Maybe I made some mistakes somewhere?</p>
  
  <h2>UPDATE</h2>
  
  <p>I understood where I made a mistake:</p>
  
  <pre><code>if (bottomNavigationView.getChildAt(2) != null) 
  </code></pre>
  
  <p>this line will always be null. So I  removed this condition, but I have an error: </p>
  
  <pre><code>kotlin.TypeCastException: null cannot be cast to non-null type com.google.android.material.bottomnavigation.BottomNavigationItemView
  </code></pre>
  
  <p>which points on this line:</p>
  
  <pre><code>itemView2.addView(notificationBadge2)
  </code></pre>
  
  <p>as I understand I make a call to removed item. But I don't know how to check if item is removed or not. Maybe someone knows how to do it?</p>