javaandroidkotlinshowcaseviewuser-guide

is there a solution for accessing the first item in a recyclerView


I'm creating a user guide and one of my items that I want to describe in my user Guide is in my recycler View help me please I'm using this library : com.github.mreram:showcaseview:1.2.0

found the solution:

private var isPlayed = false
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
    holder.onFill(holder.adapterPosition)
    if (position == 0 && !isPlayed) {
        holder.guide()
        isPlayed = false
    }
}

Solution

  • You can access recyclerview's first item by checking position of t he item in onBindview method

       public void onBindViewHolder(ViewHolder holder, int position) {
    
        if(position==0)
         // write your code here
        else
         // other code
       }