Communicate between different instances of same fragment

前端 未结 5 837
梦谈多话
梦谈多话 2020-12-20 19:56

The problem as follows. Let us have 3 tabs with fragments:

  • Tab 1 (Fragment A). Needs to send data to Tab 2.
  • Tab 2 (Fragment B). Needs to receive data
5条回答
  •  悲&欢浪女
    2020-12-20 20:28

    If you are moving from Fragment A to Fragment B, you can simply pass values to the constructor of fragment B.

    Or else if you need the same set of data to be used in all three fragments, you can use share preferences as well.

提交回复
热议问题