The problem as follows. I have 2 Tabs
with Fragments
:
Tab1) Multiple instances of FragmentA that need to send data to FragmentB
Tab2) FragmentB needs to receive data from FragmentA and update different views inside it depending on which instant of fragmentA sent the data.
Let's say I have 2 instances of FragmentA and each has a button that counts the clicks and FragmentB has 2 textviews. What I want to do is when button in first instance clicked the first textview in fragmentB updates and respectively seconds instance updates the second textview.
FragmentA has interface getData(){ public void setData()}
MainActivity
has setData(){fragmentB.updateInfo()}
FragmentB has updateInfo(){//if instance1 update textview1, if instance2 update textview2}
How do I implement my updateInfo
method to understand which instance of FragmentA called it so I can update different views in it? I guess it has something to do with tags of fragmentA but I cant figure it out.