Android databinding and ternary operator (?:) to get drawables
<p>I am trying to get drawables depending on if a function is false or true. But i am doing something wrong. So any help is appreciated</p>

<pre><code>            &lt;ImageView
              android:layout_width="24dp"
              android:layout_height="24dp"
              android:onClick="@{() -&gt; handler.onVoteClicked(gameFeed.uid)}"
              android:src="@{() -&gt; handler.existInList(feed.ratings,feed.uid) ? @drawable/ic_star_border : @drawable/ic_star}"
              android:layout_gravity="center_vertical"/&gt;
</code></pre>

<p>This is the function i am trying to call from my handler.</p>

<pre><code>  public boolean existInList(Map&lt;String,Boolean&gt; ratings, String userId) {
    for (Map.Entry&lt;String, Boolean&gt; entry : ratings.entrySet()) {
      if(entry.getValue().equals(userId)) {
       return true;
      }
    }
    return false;
  }
</code></pre>

<p><strong>Added error that i got</strong></p>

<pre><code>Execution failed for task ':app:compileDebugJavaWithJavac'.
&gt; java.lang.RuntimeException: Found data binding errors.
  ****/ data binding error ****msg:Cannot find the proper callback class 
for android:src. Tried android.graphics.drawable.Drawable but it has 4 abstract methods, should have 1 abstract methods. file:/Users/brahim/ProjectNinjo/app/src/main/res/layout/adapter_feed_row.xml loc:108:33 - 108:135 ****\ data binding error ****
</code></pre>

<p><strong>Update</strong></p>

<p>What i noticed is that it can grab the drawable. But it has problems calling that function. Im guessing that i cant call a function from a ternary operator or i am calling the function in a bad way</p>