Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

434
Views
How to use kotlin.Pair with databinding?

It is working fine as long as I am using the data model with two fields.

But when I am trying to use kotlin. Pair it is failing to build and giving nit informative error :

....\DataBinderMapperImpl.java:20: error: cannot find symbol
import .....databinding.ItemCurrencyBindingImpl;


  symbol:   class ItemCurrencyBindingImpl

  location: package ......databinding

Xml code :

    <variable
        name="currency"
        type="kotlin.Pair"/>
</data>

<TextView
    android:layout_width="@dimen/currency_dropdown_width"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:gravity="center|start"
    android:padding="@dimen/currency_dropdown_padding"
    android:text="@{currency.first}"
    app:drawableEnd="@{currency.second}"
    app:drawableSize="@{@dimen/currency_dropdown_image_size}"
    tools:text="@string/pound"/></layout>
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You need to add the import of the type pair to your data section, and also declare the type of the elements of the pair.

If you currency type is Pair<String, Int> you can declare it like this:

<import type="kotlin.Pair"/>
<variable name="currency" type="Pair&lt;String, Int&gt;"/>
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!