首页 > 其他 > 详细

Fragment 与Fragment沟通

时间:2016-04-24 15:26:53      阅读:236      评论:0      收藏:0      [点我收藏+]

模式图:

不同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.

 

Fragment 与Fragment沟通

原文:http://www.cnblogs.com/howarddeng/p/5426904.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!