CheckBox RecyclerView auto checked issue. Detailed below

Viewed 32

When I check a box and in recycler view auto-checked after 11- 12 item. I didn't even clicked that checkbox here is the code. I think this issue is in holder with the position so I'm only providing holder code because it's confidential.

Adapter holder code:

inner class ProductListViewHolder(val itemBinding: SelectProductLayoutBinding) :
    RecyclerView.ViewHolder(itemBinding.root) {
    fun bindItems(data: ManufacturingProductItem, position: Int) {
        if (data.name != null)
            itemBinding.userNameTv.text = data.name
        else
            itemBinding.userNameTv.text = ""
        itemBinding.userNameTv.setOnClickListener {
            listener.onProductClickListener(
                data,
                itemBinding.userNameTv.isChecked
            )
        }
    }
}

in belove code about pagination of recycler view kindly understand please

binding.productRv.addOnScrollListener(object : RecyclerView.OnScrollListener() {
        override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
            super.onScrollStateChanged(recyclerView, newState)
            if (newState != RecyclerView.SCROLL_STATE_IDLE) {
                return
            }
            if (!recyclerView.canScrollVertically(1)) {
                if (productAdapter.getProductResponseList.size > 2) {
                    count++
                    productPresenter.getProducts("", count.toString(), true)
                }
            }
        }
    })
0 Answers
Related