Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplication of listview rows in list fragment on orientation change

I have a ListFragment where I use a custom adapter to populate the listview. All is well until I change orientation and scroll. Then it looks like this: ListView after a few orientation changes

I am guessing it has something to do with me fumbling with a view holder, but I can't access the code right now.

like image 881
Qw4z1 Avatar asked Aug 30 '12 19:08

Qw4z1


2 Answers

The reason for the overlapping fragment was that I used FrameLayout and added the fragment with FragmentTransition.add(...). When I changed .add() to .replace() the old fragment was removed and the new one was added and my problem was solved.

like image 146
Qw4z1 Avatar answered Sep 19 '22 14:09

Qw4z1


I had similar problem and according to that i am telling the solution :- you are getting this blur because every time on orientation change somewhere new instance of listfragment is created (may be it is in oncreate()), so you have to just make an instance of list fragment once and on orientation change replace that fragment rather than adding again.

like image 22
user2240527 Avatar answered Sep 22 '22 14:09

user2240527