I have a custom FragmentWrapper
class from which I want to return a new instance every time.
But inside it, I wan't to display another Singleton Fragment
from each instance.
i.e.
There should be a single fragment
of SingletonFragment
.
And, all the instances of FragmentWrapper
should display that Singleton fragment.
I tried using nested fragment
through fragmentchildmanager
but it is not working.
Below is the code:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View root = inflater.inflate(R.layout.xxxlayout, container, false);
getChildFragmentManager().beginTransaction()
.replace(R.id.xxxcontainer, singletonfragment)
.commit();
return root;
}
Please suggest.