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.
Asked
Active
Viewed 641 times
0

Community
- 1
- 1

Taimur Amjad
- 1
- 2
2 Answers
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
-
Thanks. it totally works but is there a way that i could do it using `notifyDataSetChanged()`? And why list view is behaving like this? – Taimur Amjad Dec 30 '14 at 08:59
-
You should check the else case of your "if (row == null)" in your adapter's get View. Accept plz answer if OK ;-) – Stéphane GROSSMANN Dec 30 '14 at 09:32
-
^well it definitely work (so does `invalidateView()`) but this isn't what i am looking for. i need to do it without recreating the list. – Taimur Amjad Dec 30 '14 at 10:21
-
U didn't have to recreate the list, just to update the adpter with the two lines. I although updated the answer. – Stéphane GROSSMANN Dec 30 '14 at 10:43
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

Taimur Amjad
- 1
- 2