The problem is quite hard to find in the code.
You are reusing your ViewHolder
, which is very good as it saves you time to reallocate new memory every time.
The problem in your code is: You are not resetting the visibility of the TextView
, leading to the problem that a reused View will inherit the visibility settings of any other TextView.
In order to solve the bug you will have to store the visibility of each item together with the item itself in your adapter and reload the visibility settings when restoring the view.
Instead of String
I would use a
class AGoodClassName {
String s; boolean b;
}
Which is stored in the Adapter. You need to update b
whenever the visibility changes.