I'm curious as to why instantiateItem was deprecated in favor of it's newer version. The change is that it now receives ViewGroup in stead of a more general View.
Deprecated method
public Object instantiateItem (View container, int position)
New method
public Object instantiateItem (ViewGroup container, int position)
Note: This change also happened to destroyItem, startUpdate, finishUpdate & setPrimaryItem.
My guess is that it was done because those methods are always called with a
ViewGrouprather than the more generalView. As such, providing the parameter as aViewGroupis a convenience, allowing developers to avoid always checking and casting the input. So instead of seeing this code over and over:The implementer can simply use
containerdirectly.And, in fact, you can see that this is exactly the reason in the commit message from Adam Powell: