码迷,mamicode.com
首页 > 其他好文 > 详细

Fragment 与Fragment沟通

时间:2016-04-24 15:29:12      阅读:149      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!