title: RecyclerView jump to the top after click even
body: <p>I have been having this issue for a long time and have tried different suggestion on similar posts but all proved futile.</p>
  <p>Currently, I have a recyclerview that implements double click for likes. Whenever I do that the recyclerview jumps to the top of the page.</p>
  <p>Kindly advise on what to do to stop this.</p>
  <h2>Code</h2>
  <pre><code>    private fun setDataIntoAdapter(list: List&lt;MovieEntity?&gt;?) {
  
  
          movieAdapter = MovieAdapter(list, object : MovieAdapter.OnMovieListener {
              override fun onMovieDoubleClick(movieEntity: MovieEntity, view: View) {
  
                  val fav = view.findViewById&lt;ImageView&gt;(R.id.redFav)
  //                var favMovie = convertToFavourityEntity(movieEntity)
  
  
                  movieEntity.favourite = true
                  if (fav.visibility == View.GONE) {
                      fav.visibility = View.VISIBLE
  
  
                      CoroutineScope(Main).launch {
  
                          try {
                              insertAndUpdate(movieEntity)
                              FancyToast.makeText(
                                  context,
                                  &quot;${movieEntity.title} is added to favourite&quot;,
                                  FancyToast.LENGTH_LONG,
                                  FancyToast.SUCCESS,
                                  true
                              ).show()
                          } catch (e: Exception) {
  
                              FancyToast.makeText(
                                  context,
                                  &quot;Movie has been previously added \nto favorite&quot;,
                                  FancyToast.LENGTH_LONG,
                                  FancyToast.ERROR,
                                  true
                              ).show()
  
                          }
  
  
                      }
  
  
                  } else {
                      fav.visibility = View.GONE
                      movieEntity.favourite = false
                      CoroutineScope(Main).launch {
  
                          try {
  
                              deleteAndUpdate(movieEntity)
                              FancyToast.makeText(
                                  context,
                                  &quot;${movieEntity.title} is removed from favourite&quot;,
                                  FancyToast.LENGTH_LONG,
                                  FancyToast.INFO,
                                  true
                              ).show()
                          } catch (e: Exception) {
  
  //                                        Toast.makeText(context, &quot;Movie has been previously removed \nto favorite&quot;, Toast.LENGTH_SHORT).show()
                              val snackbar = Snackbar
                                  .make(
                                      view, &quot;Movie has been previously removed \n&quot; +
                                              &quot;to favorite&quot;, Snackbar.LENGTH_LONG
                                  )
                              snackbar.show()
                          }
  
  
                      }
                  }
  
              }
  
              override fun onSingleClick(movieEntity: MovieEntity, view: View) {
  
  
                  gotoDetails(movieEntity)
  
  //                view.deleteIcon.setOnClickListener {
  //                    singleDeletion(movieEntity)
  //                }
  
              }
  
          })
      }
  
    private suspend fun insertAndUpdate(movieEntity: MovieEntity) {
          ServiceLocator.createLocalDataSource(context!!).movieDao?.update(movieEntity)
  
      }
  
  </code></pre>
  <h2>Adapter</h2>
  <pre><code>class MovieAdapter&lt;T&gt;(private var movies:List&lt;T?&gt;?, private var listener:OnMovieListener):RecyclerView.Adapter&lt;MovieAdapter.MovieHolder&gt;()  {
  
  
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MovieHolder {
          val itemView = LayoutInflater.from(parent.context).inflate(R.layout.movie_recycler_items, parent, false)
          return MovieAdapter.MovieHolder(itemView)
      }
  
      override fun getItemCount(): Int {
          return movies!!.size
      }
  
      fun setMovie(movies: List&lt;T?&gt;?){
          this.movies = movies
          notifyDataSetChanged()
      }
      fun getMovieAt(position: Int):T?{
          return movies?.get(position)
      }
      override fun onBindViewHolder(holder: MovieHolder, position: Int) {
  //        covert.drawCornerFlag(holder)
          movies?.let{
              val currentMovies = it[position]
              holder.bind(it[position]!!, listener)
          }
      }
  
      class MovieHolder(itemView: View): RecyclerView.ViewHolder(itemView) {
  
  
          var title = itemView.findViewById&lt;TextView&gt;(R.id.title)
          var releaseDate = itemView.findViewById&lt;TextView&gt;(R.id.releaseDate)
          var ratingBar = itemView.findViewById&lt;RatingBar&gt;(R.id.ratingBar)
          var imageThmbnail = itemView.findViewById&lt;ImageView&gt;(R.id.thumbnail)
          var fav = itemView.findViewById&lt;ImageView&gt;(R.id.favourite)
          var redFav = itemView.findViewById&lt;ImageView&gt;(R.id.redFav)
          var rating = itemView.findViewById&lt;TextView&gt;(R.id.rating)
  
          fun &lt;T&gt; bind(movieEntity: T, listener: OnMovieListener){
  
              var i = 0
  
  
              if(movieEntity is MovieEntity){
                  if(movieEntity.favourite){
                      redFav.visibility = View.VISIBLE
                  }
                  else{
                      redFav.visibility = View.GONE
                  }
                  val calendar = Calendar.getInstance()
                  val dateReleased = movieEntity.releaseDate?.split(&quot;-&quot;)
                  val year = dateReleased?.get(0)?.toInt()
                  val month = dateReleased?.get(1)?.toInt()
                  val day = dateReleased?.get(2)?.toInt()
                  var newDate:Date?= null
                  if (year != null) {
                      if (month != null) {
                          if (day != null) {
                              calendar.set(year, month,day)
                          }
  
                      }
                      newDate = calendar.time
                  }
  
                  val displayDate = newDate.toString().substring(4..7) + year.toString()
                  title.setText(movieEntity.title)
                  releaseDate.setText(displayDate)
                  ratingBar.numStars = 5
                  val ratingNum = movieEntity.rating?.toFloat()?.div(2)
                  rating.setText(&quot;${ratingNum!!}&quot;)
                  ratingBar.rating = ratingNum
                  Picasso.get().load(movieEntity.movieImage).into(imageThmbnail)
                  itemView.setOnClickListener(DoubleClick(object :DoubleClickListener{
                      override fun onDoubleClick(view: View?) {
  
                          Log.i(&quot;Dob&quot;, &quot;Double clicked&quot;)
  
                          listener.onMovieDoubleClick(movieEntity, itemView)
                      }
  
                      override fun onSingleClick(view: View?) {
                          Log.i(&quot;click&quot;, &quot;Single click&quot;)
                          listener.onSingleClick(movieEntity, itemView)
                      }
  
                  }))
  
              }
  
          }
  
      }
  
      interface OnMovieListener{
          fun onMovieDoubleClick(movieEntity: MovieEntity, view:View)
          fun onSingleClick(movieEntity: MovieEntity, view: View)
      }
  
  
  }
  </code></pre>