Please sign in to comment.
fix removing views from ViewPagerAndroid
Summary: Two things in this diff: 1. Implemented `getItemPosition` in our adapter; the default implementation always returns POSITION_UNCHANGED, which is incorrect, and causes `destroyItem` to never (sometimes?) be called. 2. Fix `destroyItem`: this never worked. `destroyItem` is always called by the ViewPager after a `notifyDataSetChanged()`, so after `removeViewAt`, which removes the view from `mViews`, causing `destroyItem` to throw `IndexOutOfBoundsException` when it tries to get the view. Since our item objects are just views, use that instead of checking `mViews`. Reviewed By: ahmedre Differential Revision: D3555427 fbshipit-source-id: 900c2696162d07f507e850517d483b943ce39a35
- Loading branch information...
Showing with 7 additions and 3 deletions.