Fragment 与Fragment沟通
模式图:
不同activity 里面的fragment
同一个activity里面的两个fragment
详给解释一下activity 内部的fragment 怎么沟通,
In FragmentA:
firstly before we add the FragmentB to transaction,we can set target fragment as FragmentA for the FragmentB ,we are going to add together with request code.At the same time we can overide the onActivityResult to get the data in the intent and validate the result code.
In FragmentB:
we can store the data in intent and get the target Fragment to call its OnActivityResult directly passing in the intent ,result code.
Finally our FragmentA will get the result code.