title: Android data-binding - Can I access the enclosing activity in the layout XML?
body: <p>I'd like to define an event listener in the XML that finishes the enclosing activity, like this:</p>
  
  <pre><code>&lt;EditText
      android:id="@+id/finish"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:imeOptions="actionDone"
      android:inputType="text"
      android:onEditorAction="@{() -&gt; activity.finish()}" /&gt;
  </code></pre>
  
  <p>However, I don't have a reference to the enclosing activity. I know I can pass it using a <code>&lt;variable&gt;</code>, but <code>Activity</code> seems a too common variable to be explicitly passed in every layout... I thought data-binding was introduced to simplify code. I didn't find any hint in the <a href="https://developer.android.com/reference/android/databinding/ViewDataBinding.html" rel="noreferrer">ViewDataBinding</a> class.</p>