title: Flexbox doesn't support cardview inside?
body: <p>I want to create many cardviews inside flexbox layout. But i it always return NullPointerException. What error console said</p>
  <blockquote>
  <p>android.view.InflateException: Binary XML file line #17: Attempt to
  invoke virtual method 'boolean
  java.lang.String.equals(java.lang.Object)' on a null object reference
  Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on
  a null object reference
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
  at com.tribunnews.app.utils.CommonViewKt.inflate(CommonView.kt:193)
  at com.tribunnews.app.itemview.DetailTagsViewHolder.onBind(DetailTagsViewHolder.kt:34)
  at com.tribunnews.app.adapter.DetailAdapter.onBindViewHolder(DetailAdapter.kt:118)
  at com.tribunnews.app.adapter.DetailAdapter.onBindViewHolder(DetailAdapter.kt:17)
  at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7263)
  at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7343)
  at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6204)
  at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6470)
  at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:288)
  at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:345)
  at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:361)
  at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:368)
  at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:399)
  at android.os.Handler.handleCallback(Handler.java:873)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:193)
  at android.app.ActivityThread.main(ActivityThread.java:6669)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)</p>
  </blockquote>
  <p>i have tried manually create in layout xml still return crash, like this</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout
      xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:orientation=&quot;horizontal&quot;&gt;
  
      &lt;com.google.android.flexbox.FlexboxLayout
          android:id=&quot;@+id/flexbox_parent&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:visibility=&quot;visible&quot;
          android:layout_marginTop=&quot;16dp&quot;
          app:flexWrap=&quot;wrap&quot;&gt;
  
          &lt;androidx.appcompat.widget.AppCompatTextView
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;32dp&quot;
              android:layout_margin=&quot;4dp&quot;
              android:drawablePadding=&quot;2dp&quot;
              android:fontFamily=&quot;sans-serif&quot;
              android:gravity=&quot;center&quot;
              android:text=&quot;Tags&quot;
              android:textColor=&quot;?attr/textcolorsecondary&quot;
              android:textSize=&quot;14dp&quot;
              android:textStyle=&quot;bold&quot;
              app:drawableLeftCompat=&quot;@drawable/ic_tag_gray&quot;
              app:drawableTint=&quot;@color/colorPrimary&quot;/&gt;
  
  
          &lt;androidx.cardview.widget.CardView 
              android:layout_height=&quot;40dp&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:paddingLeft=&quot;8dp&quot;
              android:paddingRight=&quot;8dp&quot;
              android:layout_margin=&quot;4dp&quot;
              app:cardCornerRadius=&quot;@dimen/_4dp&quot;&gt;
  
              &lt;LinearLayout
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;match_parent&quot;
                  android:background=&quot;@color/colorSeparatorLight&quot;
                  android:orientation=&quot;horizontal&quot;&gt;
  
                  &lt;view
                      android:id=&quot;@+id/color_tags&quot;
                      android:layout_width=&quot;3dp&quot;
                      android:layout_height=&quot;match_parent&quot;
                      android:background=&quot;#ff1000&quot;/&gt;
  
                  &lt;TextView
                      android:layout_width=&quot;wrap_content&quot;
                      android:layout_height=&quot;match_parent&quot;
                      android:layout_gravity=&quot;center_vertical&quot;
                      android:layout_marginStart=&quot;@dimen/_4dp&quot;
                      android:layout_marginEnd=&quot;@dimen/_4dp&quot;
                      android:gravity=&quot;center&quot;
                      android:fontFamily=&quot;sans-serif&quot;
                      android:text=&quot;UU Cipta kerja&quot;
                      android:textColor=&quot;@color/colorPrimary&quot;
                      android:textSize=&quot;14dp&quot;
                      android:textStyle=&quot;bold&quot;
                      android:clickable=&quot;true&quot;
                      android:focusable=&quot;true&quot;
                      android:id=&quot;@+id/tag_text&quot;
                      android:background=&quot;@color/colorSeparatorLight&quot;/&gt;
              &lt;/LinearLayout&gt;
  
          &lt;/androidx.cardview.widget.CardView&gt;
  
      &lt;/com.google.android.flexbox.FlexboxLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  <p><strong>Update</strong>
  Actually i want to create layoutInflater for cardview and add that items inside flexboxlayout. This is my viewholder where the inflater begin</p>
  <pre><code>class DetailTagsViewHolder(private val readActivity: ReadActivity,
                             val site : String?,
                             view: View) : DetailItemViewHolder(view) {
  
      private val ctx = view.context
  
      private val lsColor = listOf&lt;Int&gt;(R.color.tag_one, R.color.tag_two, R.color.tag_three,R.color.tag_four )
  
      override fun onBind(data: DetailItemUIModel) {
  
          (data as? DetailItemUIModel.TagList)?.let {
              val tags = it.list
              itemView.run {
  
                  var tipsC = 0
                  tags?.forEachIndexed { index, trendingTag -&gt;
                      if (tipsC &gt; index) {
                          tipsC = 0
                      }
                      val cardTag = ctx.inflate(R.layout.item_card_tag, flexbox_parent) as CardView
  
                      cardTag?.let {
                          if (!trendingTag.title.isNullOrEmpty()) {
                              val tipColorTag = cardTag.findViewById&lt;View&gt;(R.id.color_tags)
                              tipColorTag.setBackgroundColor(ContextCompat.getColor(context, lsColor[tipsC]))
  
                              val tagText = cardTag.findViewById&lt;TextView&gt;(R.id.tag_text)
                              tagText.text = trendingTag.title
  
                              cardTag.setOnClickListener {
                                  readActivity.gotoPopularActivity(site,
                                          trendingTag.alias, site != &quot;tribunnews&quot;,
                                          Constant.API_TYPE_TAG_QUERY, trendingTag.title)
                              }
                              tipsC++
                          }
                          flexbox_parent.addView(cardTag)
                      }
                  }
              }
          }
  
      }
      override fun onRecycled() {}
  }
  </code></pre>
  <p>and Extension function for inflate is</p>
  <pre><code>fun Context.inflate(layout: Int, parent: ViewGroup?): View {
      return LayoutInflater.from(this).inflate(layout, parent, false)
  }
  </code></pre>