title: Kotlin custom attribute databinding
body: <p>I am trying to set custom attribute using the <a href="https://developer.android.com/topic/libraries/data-binding/index.html" rel="noreferrer">Android DataBinding Library</a>
  in my Kotlin project like this:</p>
  <h3>Layout</h3>
  <pre><code>&lt;ImageView
      android:id=&quot;@+id/imgView”
      android:layout_width=&quot;40dp&quot;
      android:layout_height=&quot;40dp&quot;
      android:layout_gravity=&quot;center&quot;
      android:adjustViewBounds=&quot;true&quot;
      app:imageUrl=&quot;@{segment.url}&quot;/&gt;
                              
  </code></pre>
  <h3>Code</h3>
  <pre><code>class Utils {
      companion object {
          @BindingAdapter(&quot;bind:imageUrl&quot;)
          @JvmStatic
          fun loadImage(view: ImageView, url:String) 
          {Picasso.with(view.context).load(url).error(R.drawable.error).into(view)}
      }
  }
  
      
  
      
  </code></pre>
  <p>The runtime error I get is:</p>
  <blockquote>
  <p>A BindingAdapter in in &lt;package.Utils.Companion&gt; is not static and requires an object to use, retrieved from the DataBindingComponent. If you don't use an inflation method taking a DataBindingComponent, use DataBindingUtil.setDefaultComponent or make all BindingAdapter methods static.</p>
  </blockquote>
  <p>Any pointers to solve it?</p>
  <p>This happens only for custom attributes. The rest of the databindings work fine</p>