Skip to content Skip to sidebar Skip to footer

Howto Androidx-databinding For Onclick To Static Method With Parameter

(Note: this is a follow up question to Is it possible to use androidx-navigation with onClick-databinding without writing boilercode in Fragment? I want to use androidx-databinding

Solution 1:

You might have forgot to bind the layout with the activity.

Change

setContentView(R.layout.your_layout_file);

To

DataBindingUtil.setContentView(this, R.layout.your_layout_file);

If that's not the issue, you may check the working sample I created on calling static method using data binding.

Post a Comment for "Howto Androidx-databinding For Onclick To Static Method With Parameter"