I would like to define an event listener in XML that completes the closing activity, for example:
<EditText
android:id="@+id/finish"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:inputType="text"
android:onEditorAction="@{() -> activity.finish()}" />
However, I have no reference to the activity involved. I know that I can pass it using <variable>, but Activityit seems too common a variable that should be explicitly passed in each layout ... I thought that data binding was introduced to simplify the code. I did not find any hint on the ViewDataBinding class .
source
share