关于fragment的传值问题
Posted Mr.Biandan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于fragment的传值问题相关的知识,希望对你有一定的参考价值。
以下是摘录自http://stackoverflow.com/questions/13700798/basic-communication-between-two-fragments上的评论内容。
貌似官方提倡使用接口来实现fragment之间的传值问题,本文将持续更新。 以下方法可以解决fragment之间的通信问题,但是还有其他的方法,我将会总结后持续更新,欢迎留言讨论交流。Basic Communication between two fragments
6 4 |
I have one I am trying to pass the I am aware that a fragment can get a reference to it's activity using
| |||
add a comment |
4 Answers
active oldest votes9 |
Have a look at the android deverlopers page:http://developer.android.com/training/basics/fragments/communicating.html#DefineInterface Basically, you define an interface in your Fragment A, and let your Activity implement that Interface. Now you can call the interface method in your Fragment, and your Activity will receive the event. Now in your activity, you can call your second Fragment to update the textview with the received value
| ||||||||||||||||
|
以上是关于关于fragment的传值问题的主要内容,如果未能解决你的问题,请参考以下文章
关于bootstrap 表单 带有多选下拉列表和kkpager翻页 的传值问题