Skip to content

fix recreateViews#3

Merged
Jawnnypoo merged 1 commit intoCommit451:masterfrom
t7costa:master
Apr 27, 2017
Merged

fix recreateViews#3
Jawnnypoo merged 1 commit intoCommit451:masterfrom
t7costa:master

Conversation

@t7costa
Copy link
Copy Markdown
Contributor

@t7costa t7costa commented Apr 26, 2017

you can't remove views in the same loop since the positions change

@Jawnnypoo
Copy link
Copy Markdown
Member

Hey there, thanks for the PR.

Do you have an example of when/where this was causing issues?

@t7costa
Copy link
Copy Markdown
Contributor Author

t7costa commented Apr 26, 2017

Sure - if you create an adapter with 10 items, then replace it with 5 items and call notifyDataSetChanged() the resulting view would have 7 items. This is happening because the code tries to remove the child views by position 5,6,7,8,9 in that order - but once we remove child 5 the positions all shift back by one so we actually need to remove the child at position 5 each time instead (or remove it as a range like in my PR).

@Jawnnypoo
Copy link
Copy Markdown
Member

Awesome, thanks for catching this issue!

@Jawnnypoo Jawnnypoo merged commit 4f31236 into Commit451:master Apr 27, 2017
@Jawnnypoo
Copy link
Copy Markdown
Member

Released as 1.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants