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
Post a Comment