I have a viewpager that pages through fragments. My FragmentPagerAdapter
subclass creates a new fragment in the getItem
method which seems wasteful
I know this is (theoretically) not an answer to the question, but a different approach.
I had an issue where I needed to refresh the visible fragments. Whatever I tried, failed and failed miserably...
After trying so many different things, I have finally finish this using BroadCastReceiver
. Simply send a broadcast when you need to do something with the visible fragments and capture it in the fragment.
If you need some kind of a response as well, you can also send it via broadcast.
cheers