nemi
10/30/2018, 12:16 PMclass Foo {
@BindView(R2.id.someText) @JvmField var someText: TextView? = null
fun bind(activity: Activity) {
ButterKnife.bind(this, activity)
requireNotNull(someText)
}
}
The app module has a single activity with the following onCreate
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Foo().bind(this)
}
When running this “app” it will crash with an `IllegalArgumentException`as the someText
field is going to be null.
The generated Foo_ViewBinding
uses the following piece of code to bind someText
target.someText = Utils.findOptionalViewAsType(source, 2131492945, "field 'someText'", TextView.class);
2131492945 is the value of R.id.someText