I'm not sure what may be the cause of the problem but I'll give you a hint that may help.
I don't think that you should reference the Fragments
in the Adapter
from the Activity
.
Mainly due to the fact that it's pretty hard to synchronize the Activity
life-cycle, Fragment
lifecycle and ViewPager
children life-cycles. And if any bugs emerge the debugging can be really painful.
Believe me, been there, done that...
By the way - is there a reason why you need references to Fragments
in your Activity
?
EDIT
I don't think you should pass the information between the Fragments
this way. In general the FragmentManager
handles (creates, deletes) Fragments
on it's own and you cannot be sure that these Fragments
will be available at any time.
I think that the best way would be to move your data to separate model (database entry, SharedPreference
or a singelton class) and then letting know the Adapter
that data has changed (by a DataObserver
in Fragments
or simply notify the Adapter
to update children data by calling notifyDataChanged
).
EXAMPLE
FragmentA --->listener (reloadData()
)--->Activity--->adapter.notifyDataChanged()
-----> fragmentB gets updated
This way if you ever want to add a ThirdFragment
or in fact any number of Fragments
that will use the Data you will not have to worry about updating data in any of these - just let the Adapter
worry about it.