title: Data-binding on BottomSheetDialog Layout (Crash)
body: <p>I am having trouble getting data-binding to work properly on a BottomSheetDialog layout.  Here are the details:</p>
  
  <p>Definition and setting of var:</p>
  
  <pre><code>private lateinit var myDrawerBinding: MyDrawerBinding
  
  myDrawerBinding = MyDrawerBinding.bind(myDrawerContent) // crashes on this line
  </code></pre>
  
  <p>and later it's set and shown this way (although it never gets to this point)</p>
  
  <pre><code>myDrawerBinding.viewModel = theViewModel
  
  val bottomSheet = BottomSheetDialog(context)
  bottomSheet.setContentView(myDrawerBinding.myDrawerContent)
  bottomSheet.show()
  </code></pre>
  
  <p>Here is a snippet of the XML layout (my_drawer.xml):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layout xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
  &lt;data&gt;
      &lt;import type="android.view.View"/&gt;
      &lt;variable name="viewModel" type="path.to.my.viewModel"/&gt;
  &lt;/data&gt;
  
  &lt;RelativeLayout
          android:id="@+id/myDrawerContent"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:padding="10dp"&gt;
  
      &lt;View
              android:layout_width="50dp"
              android:layout_height="3dp"
              android:visibility="@{viewModel.shouldShowView() ? View.VISIBLE : View.GONE}"/&gt;
  ....
  </code></pre>
  
  <p>The crash occurs when it calls the .bind() method above, and the error is:</p>
  
  <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.view.View.getTag()' on a null object reference
  </code></pre>
  
  <p>This same exact functionality works on a separate DrawerLayout that I am showing in the same Fragment, but for some reason the BottomSheetDialog layout is giving problems.</p>