Updating data source

Posted by / 07-Nov-2019 14:59

Updating data source

View Pager is a layout manager that allows users to flip and view pages left and right.

It is suitable in the situation where the number of fragments are large.To overcome this problem we will supply data to the fragments using a setter while creating the fragment first time and override instantiate Item() method to check whether the old data and new data are different or equal.If new data is not equal to old data, we replace the old data with new one using the same setter.* Currently Active Fragments means one which is currently visible one is before it and one is after it.* * @param object Active Fragment reference * @return Returns the index of the currently active fragments.

updating data source-55updating data source-82updating data source-13

Don’t forget to call super.instantiate Item(container, position) at end of the method.