title: How to pass an argument to a function in data binding?
body: <p>I have two variables inside my layout file :</p>
  
  <pre><code>&lt;data&gt;
    &lt;variable name="createExpenseViewModel" type="com.lionosur.dailyexpenses.viewModels.MainViewModel"/&gt;
    &lt;variable name="createExpenseConverter" type="com.lionosur.dailyexpenses.converters.createExpenseActivityConverter.Companion"/&gt;
  &lt;/data&gt;
  </code></pre>
  
  <p>My view model has an method to return the live data :</p>
  
  <pre><code>fun getAllExpenseItems(): LiveData&lt;List&lt;Expense&gt;&gt; {
      return expenseRepository.getAllExpenseItems()
  }
  </code></pre>
  
  <p>I need to observe this data and populate an spinner,</p>
  
  <pre><code>class createExpenseActivityConverter {
      // contains all the static methods to convert the data for the ui
      companion object {
  
          fun getExpenseCategoryListFromSource(list:List&lt;Source&gt;):ArrayList&lt;String&gt; {
              val categoryItems = ArrayList&lt;String&gt;()
              categoryItems.addAll(list.map { it.sourceName })
              return categoryItems
          }
      }
  }
  </code></pre>
  
  <p>to populate a spinner I need to supply an array list of string</p>
  
  <pre><code>&lt;Spinner
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:id="@+id/expense_category"
          android:entries="@{()-&gt; createExpenseViewModel.getAllSourceItems(1) }"
          app:layout_constraintStart_toStartOf="@+id/textView"
          android:layout_marginTop="20dp"
          app:layout_constraintTop_toBottomOf="@+id/textView" app:layout_constraintWidth_percent="0.7"
  /&gt;
  </code></pre>
  
  <p>in <strong>android:entries</strong> I need to convert the observed data to array list of string, how do I pass the <code>@{()-&gt; createExpenseViewModel.getAllSourceItems(1) }</code> result in to another static method <code>createExpenseViewConverter.getExpenseCategoryListFromSource(sourceList)</code> which would return a array list of string.</p>
  
  <p>in my activity i have setup binding like this</p>
  
  <pre><code>binding = DataBindingUtil.setContentView(this, R.layout.activity_create_expense)
  
  
  
  val mainViewModel =  DaggerExpenseComponent.builder()
      .setContext(this)
      .build()
      .getExpenseViewModel()
  
  binding.setLifecycleOwner(this)
  binding.createExpenseViewModel = mainViewModel
  </code></pre>