I have a ViewHolder than contains, among other widgets, a SeekBar. The SeekBar has a Listener, which is added during the onCreateViewHolder
call.
Since the onBindViewHolder
method is used to configure the Views held by the ViewHolder, how can that Listener then act upon the new dataset represented by the ViewHolder's Views?
Is it OK to add a member variable of type Object to the ViewHolder, which contains a reference to the dataset, so that the Listener can then take this object and modify a variable in the dataset during SeekBar-changes? Or is this an Anti-Pattern?
The dataset object referenced by that member variable would then get swapped out on every onBindViewHolder
in order to "point" to the currently represented dataset.