Pass another view as parameter in data binding

The member generated for the id-able has a CamelCase name format. Also the view provided to the OnClickListener is the view being clicked. So just name the parameter arbitrarily and use the correct "global" member.

android:onClick='@{(v) -> viewModel.subjectRequest(faqTitleAbout.getText())}'

If you are coding in Kotlin you could be tempted to write the following:

android:onClick='@{(v) -> viewModel.subjectRequest(faqTitleAbout.text)}'

It won't work, because the binding class is generated by the framework in Java. Another problem is that with EditText views you need to add also a call to

toString()

If you want to call a function that takes a string as parameter. So the code would be:

android:onClick='@{(v) -> viewModel.subjectRequest(faqTitleAbout.getText().toString())}'

That's how it works with Kotlin and Android Studio 4.1.2, otherwise you get a build error (...a weird one...). I don't know if that will change in the future or it has a different behavior with other versions.