I have searched for solution and found so many cases (not relevant to my situation or may be i didn't understood them properly).
My case is :
Let's say i have one parent Fragment Parent;
And i'm creating two child fragments form parent fragment's onCreateView
ChildFragment1 child1 = new ChildFragment1();
ChildFragment2 child2 = new ChildFragment2();
//My child fragment exactly looks like this
public class ChildFragment1 extends Fragment {
View rootView;
public ChildFragment1() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
rootView = inflater.inflate(R.layout.child_layout, container, false);
return rootView;
}
public void methodTobeCalled() {
//here i would like to do some changes to child view (add some views)
}
}
i can access method of child fragment through reference of child like
child1.methodTobeCalled();
But at this time i don't have access to my child Fragment View.
I would like to call my child Fragment function from parent fragment when i have access to child view, is there any chance?
Thanks in advance :)