title: Exception recyclerview cardview
body: <p>Getting a large number of exceptions which I cannot reproduce like these:-</p>
  
  <pre><code>Fatal Exception: java.lang.IllegalArgumentException: view is not a
  child, cannot hide androidx.cardview.widget.CardView{5dd439c V.E...C..
  ......I. 20,-228-680,-78} 
  at androidx.recyclerview.widget.b.e(ChildHelper.java:352) 
  at androidx.recyclerview.widget.RecyclerView$p.b(RecyclerView.java:6393)
  </code></pre>
  
  <p>There is no link from my source. But using Crashlytics log I think I know the approximate area of problem. The recycler adapter row is a very simple layout with a cardview at the root and a relative layout as the child. What could be the cause of this exception ?</p>
  
  <p>Edit: My adapter</p>
  
  <pre><code>internal class AnalyzerAdapter(private val fragment: AnalyzerFragment,
                                 private val context: Context) : RecyclerView.Adapter&lt;AnalyzerAdapter.Companion.ViewHolder&gt;() {
      private val entries = ArrayList&lt;AnalyzerData&gt;()
      override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ViewHolder {
          val parent = LayoutInflater.from(context).inflate(R.layout.analyzer_row, viewGroup, false)
          return ViewHolder(parent)
      }
  
      override fun onBindViewHolder(holder: ViewHolder, position: Int) {
          val entry = entries[position]
          holder.tvSize.text = "title"
          holder.tvDetails.text = "details"
          val type = getItemViewType(position)
          holder.itemView.setOnClickListener {
              fragment.onListClick(type)
          }
          when (type) {
              ...
          }
      }
  
      override fun getItemViewType(position: Int): Int {
          return entries[position].dataType
      }
  
      override fun getItemCount(): Int {
          return entries.size
      }
  
      fun addEntry(entry: AnalyzerData) {
          entries.add(entry)
          notifyItemInserted(entries.size - 1)
      }
  
      fun editEntry(entry: AnalyzerData, position: Int) {
          entries[position] = entry
          notifyItemChanged(position)
      }
  
  
      fun initEntries(list: List&lt;AnalyzerData&gt;) {
          entries.clear()
          entries.addAll(list)
          notifyDataSetChanged()
      }
  
      companion object {
  
          internal class ViewHolder(parent: View) : RecyclerView.ViewHolder(parent) {
              var ivIcon: ImageView = parent.findViewById(R.id.analyzer_icon)
              var tvTitle: TextView = parent.findViewById(R.id.analyzer_title)
              var tvDetails: TextView = parent.findViewById(R.id.analyzer_details)
              var tvSize: TextView = parent.findViewById(R.id.analyzer_size)
          }
      }
  }
  </code></pre>