4

In the latest Gradle plugin When I try to access the adapter position field IDE showing as deprecated. Suggesting to use getBindingAdapterPosition() instead of adapterPosition

But When I try to access the field getBindingAdapterPosition() IDE is throwing error as

Could not find accessor com.rizek.android.users.adapters.recyclerview.cart.ProductListAdapter.ExpandViewHolder.bindingAdapterPosition

My XML File :

        <ImageView
        android:id="@+id/imageView14"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="16dp"
        android:onClick="@{()->frequencyOptionInteractor.onRecurringOptionChanged(recurringViewHolder.adapterPosition,frequencyOption)}"
        android:padding="8dp"
        app:layout_constraintBottom_toBottomOf="@+id/linearLayout12"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="@+id/linearLayout12"
        app:srcCompat="@drawable/frequency_option_selector"
        bind:stateActivated="@{frequencyOptionAdapter.selectedPosition==recurringViewHolder.bindingAdapterPosition}" />
Arunachalam k
  • 734
  • 1
  • 7
  • 20

2 Answers2

4

If you haven't done it yet, you can try to add RecyclerView manually to your

build.gradle 

file (module) :

// RecyclerView
implementation "androidx.recyclerview:recyclerview:1.2.0"

This worked for me.

user2424380
  • 1,393
  • 3
  • 16
  • 29
0

If you are using ViewPager2 make sure to add it as dependency.

implementation "androidx.viewpager2:viewpager2:1.0.0"
Hitesh Sahu
  • 41,955
  • 17
  • 205
  • 154