Values inside listview row gets duplicated upon scrolling

602 views Asked by At

I am stuck for a few days now and cant get anyway near the answer - I have a listview with imageview and next to it a flowlayout (it does the same with linearlayout though) I extended the base adapter such that it adds the images from a db query and also I add dynmically textviews to the flowlayout (or linearlayout it doesnt really matter since it do the same thing for both) problem is everytime a view gets recycled (meaning leaves the screen and then gets back to it) the textview values are being duplicated...I cant understand why and lost any hope (in android, mobile OS as a general and mankind... =|) any help?

2

There are 2 answers

0
Sonusingh Chauhan On

Since you add TextView dynamically and View get recycled, you need to remove all previous TextView from recycled View and add new TextView again in recycled View.

0
crazyPixel On

After an exahusting debug and some research - The values get duplicated since I added them on the baseadapter getview each time, to prevent them from being duplicated you only need to add them when the convertview is null, when its not the view needs to get recycled and the values are "there" already.