In Kotlin :
Here i'm passing a view as a parameter onClick of Another view
define your Handler class object first in xml layout like this:
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:bind="http://schemas.android.com/tools">
<data>
<import type="android.view.View" />
<variable
name="handler"
type="com.demoapp.controllers.Handler" />
</data>
and define button which perform click functionality.
<Button
android:id="@+id/button2"
android:onClick="@{(view) -> handler.getbuttonClickEvent(textViewId)}"
.../>
and your text view like this:
remember your TextView id will be converted like textViewId
<TextView
android:id="@+id/text_view_id"
... />
final set up method in your Handler class
fun getbuttonClickEvent(view: TextView){
view.text="Hello World"
}