In order to reuse the Fragment
UI components, you should build each as a completely self-contained, modular component that defines its own layout and behavior.
An Activity
can act as a container of the Fragment
s. So, if one Fragment
needs to pass something to another Fragment
, it can pass it to the Activity
, which in turn can pass it to the other Fragment
.
The ideal way of doing it is to have a Callback interface defined in your Fragment
and have the Activity
implement it. In your Fragment
you call one of the Callback methods passing it the array or the item. In the implementation of the method, in the Activity
, it can consume it / pass it to other Fragment
.
More information on Fragment
- Activity
communication is here.