title: How to set app:icon dynamically with data binding?
body: <p>I have this XML:</p>
  <pre><code>&lt;Button
       android:id=&quot;@+id/btn_default&quot;
       app:icon=&quot;@{model.actionBarData.myDynamicIcon}&quot; /&gt;
  </code></pre>
  <p>And I have this method and LiveData in my model's actionBarData to set the icon programmatically:</p>
  <pre><code>private var _myDynamicIcon = MutableLiveData&lt;Int&gt;()
  val myDynamicIcon: LiveData&lt;Int&gt;
      get() = _myDynamicIcon
  
  
  // Called by some logic in my app
  
  fun setMyDynamicIcon() {
      _myDynamicIcon.value = when (status) {
          status.STATUS1 -&gt; R.drawable.icon1
          status.STATUS2 -&gt; R.drawable.icon2
          status.STATUS3 -&gt; R.drawable.icon3
      }
  }
  </code></pre>
  <p>I want the icon to change when <code>setMyDynamicIcon</code> is called. However I get error:</p>
  <p><code>Cannot find a setter for &lt;android.widget.Button app:icon&gt; that accepts parameter type 'androidx.lifecycle.LiveData&lt;java.lang.Integer&gt;'</code></p>
  <p>I also tried storing a <code>Drawable</code> object in <code>myDynamicIcon</code>, this did not work either (same error but with  <code>Drawable</code> type).</p>
  <p>How can I set the <code>app:icon</code> via data binding?</p>