0

I have spent the better part of two days searching for an answer that solves my question, I have found plenty that come close but not specific to what I need:

I would like to add a new FragmentActivity to a viewPager from inside a current FragmentActivity by calling the FragmentPageAdapter (or at least, this is how I see I need to solve my problem).

For example: In fragment 1 I would like to press a button to update and replace Fragment 2 with new data, and then set Fragment 2 as the currently viewed fragment.

phalt
  • 1,164
  • 1
  • 8
  • 21

1 Answers1

0

What you could do is implementing a custom FragmentPagerAdapter or FragmentStatePagerAdapter (If you have lots of more complex fragments).

Documentation: http://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter.html

The Adapter handles your contents so whatever calls or operations you wanna make on a certain fragment could be done quite easy from there.

You could pass the adapter itself to every fragment that its holding or just implement listener interfaces so that the fragments can trigger the changes through the adapter.

I hope this helps you out if its still an issue!

Ostkontentitan
  • 6,536
  • 5
  • 51
  • 69