-2
私は2つの "子"断片と "親"断片を持っているので、どのように私はその "子"断片間でデータを渡すことができますか? ありがとうございました!2つの間でデータを渡す方法子フラグメントは親ParentFragmentから継承しますか?
私は2つの "子"断片と "親"断片を持っているので、どのように私はその "子"断片間でデータを渡すことができますか? ありがとうございました!2つの間でデータを渡す方法子フラグメントは親ParentFragmentから継承しますか?
Create newInstance() of ClidFragment and set the arguments--
public static ClidFragment newInstance(String arg1, String agr2) {
ClidFragment fragment = new ClidFragment();
Bundle args = new Bundle();
args.putString(Key_arg1, arg1);
args.putString(Key_arg2, arg2);
fragment.setArguments(args);
return fragment;
}
Receive arguments in ClidFragment Fragment--
(Write this code in on create)
Bundle args = getArguments();
String arg1 = args.getString(Key_arg1);
String arg2 = args.getString(Key_arg2);
SetArgument form Parent Fragment --
When you are replacing fragment then set The argument like this-
ClidFragment childFragment= ClidFragment.newInstant(arg1,arg2);
then replace your fragment using childFagment.
//Hope this help you
oh ...ありがとう –