Android RecyclerView and custom Adapter position elements changes

I have a RecylcerView filled with a Custom Adapter recylerView.setAdapter(myAdapter), and the adaper is filled with different elements by an ArrayList. In the ViewHolder i overrided the public void onBindViewHolder(@NonNull ViewHolder viewHolder, int position) method. In the custom ViewHolder i put a button. The button has a click listener on it. When i click the button i read the variable position and i am facing that the variable changes every time i click the same button. Why this happens?

Thanks to everyone helping me to understand



from Recent Questions - Stack Overflow https://ift.tt/3empi7K
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation