Updating your computer
However, I'm having a hard time figuring out how to update the View Pager with a new set of Views.I've tried all sorts of things like calling even creating a brand new adapter each time I want to use a new List of data.Nothing has helped, the textviews remain unchanged from the original data.Update: I made a little test project and I've almost been able to update the views. What doesn't appear to update however is the 2nd view, the 'B' remains, it should display 'Y' after pressing the update button. My view Pager will show the new searc results but doesn't default back to the first entry in the cursor.At first, I try to use rui.araujo's way, because it's easy.
My case is not updating the fragment, but removing or adding fragments dynamically.However, they will now be refreshed and you will see the new data - your users won't know the page was ever incorrect because this refreshing will happen before they see the page. After a lot of searching for this problem, I found a really good solution that I think is the right way to go about this.Essentially, instantiate Item only gets called when the view is instantiated and never again unless the view is destroyed (this is what happens when you override the get Item Position function to return POSITION_NONE).In pseudo code: I am just posting this answer in case anyone else finds it useful.For doing the exact same thing, I simply took the source code of the View Pager and Pager Adapter from the compatibility library and compiled it within my code (You need to sort out all the errors and imports yourself, but it definitely can be done).