Reputation: 5092
I have an ActionBarActivity that has a ViewPager with two Fragments and tabs created with ActionBar from the support library. My ActionBarActivity has also two buttons: cancel and save. When the save button is pressed, I need to get data from both of my Fragments. How do I do this? This data is stored fetched from the layout and stored in local variables in the Fragments.
Upvotes: 1
Views: 618
Reputation: 1419
You should be able get access to your fragments by use of FragmentManager
by id or tag. getFragmentManager().findFragmentById()
or getFragmentManager().findFragmentByTag()
Upvotes: 1