0

someone already asked a similar question here But my animation works fine for all other list items except top 3-4 list items that are visible after the listview is created. Basically, i call NotifyDataSetChanged() and then based on a condition implemented in getView() i start valueAnimation on TextView. I have no idea why its listview behaving like this.. and What could be the reason behind this?
And how can i handle this issue without calling InvalidaeViews().
I have double/triple checked my logic and even asked someone else so lets assume my logic is working fine. Thanks.

Community
  • 1
  • 1

2 Answers2

0

I had a similar problem, and instead of

NotifyDataSetChanged()

Which didn't change anything, I tried with creating a new adapter, and set it to the listview.

userAdapter = new UserCustomAdapter(.....);
userList.setAdapter(userAdapter); 

Hope it helps.

EDIT : check these lines too

  if (row == null) {
       LayoutInflater inflater = ((Activity) context).getLayoutInflater();
       row = inflater.inflate(layoutResourceId, parent, false);
       holder = new UserHolder();
      } else {
       holder = (UserHolder) row.getTag();
      }
Stéphane GROSSMANN
  • 369
  • 2
  • 5
  • 14
0

Finally i have solved it using [RecyclerView][1].
Now i don't have to invalidateViews() or reset the new MyAdapter(...).
Also another issue i was facing was when i run animation on a textview (in a list item) and on scrolling (listview) your viewHolder recycle/reuses that list item then the animation might be running on textview. So i have to handle this as well. Thanks