views:

152

answers:

1

Hi, Im using ListView to to show some custom data, once data is updated in the adapter i call notifyDatasetChanged(), so the view will get updated, all of this works well, my issue though is i would like to run an animation once only on items that got changed when the adapter was updated. currently i keep a copy of all the changed objects and i tried to animate the correct items through the getView() call.

However if i do it only once for every getView call then i see no animation most of the time on items that changed. if i continue to do so in successive getView calls i see animation on items that don not change as well and also the ones that changed get animated again and again.

Im guessing sometimes android calls the getView() for other reasons than showing the generated view immediately, and thats the reason it doesnt work if i do it once.

What is the correct way to do this?

Thanks, Totem.

A: 

If anyone is has this problem as well the way around it is to extend listview and override

onMeasure(int widthMeasureSpec, int heightMeasureSpec) 

and inside manually set the size with

setMeasuredDimension()

make sure not to call the super onMeasure() since it will call getview on all your children views with a disposeable view just to measure them.

totem