0

i've read the guide at Passing data between a fragment and its container activity regarding this, but i still can't understand how to do it(still learning Android).

I have an activity that has a button on it, that i want to take it data from an inflated fragment when i click it. The problem is that i am using multiple different fragments, and i don't know how i can generalise referencing them, or call any of them for that matter. Doing some googling, I think i need to be using findFragmentbyId to reference it, but it doesn't seem to like that. I'm not sure on how to proceed

Community
  • 1
  • 1
glendunbar
  • 23
  • 3
  • u need interface mechanism – Sush Jun 02 '16 at 09:25
  • i've implemented the onDataPass interface as described in the guide. – glendunbar Jun 02 '16 at 09:35
  • ur problem is sending data to fragment or getting data from it on some event ? or ur not understanding from which fragment data is coming ?\ – Sush Jun 02 '16 at 09:43
  • when i click the button on the container activity, i don't know what i need to set up in the onClick to be able to collect the data contained in the fragment. I need to know what fragment(of the three the page uses) is currently inflated, and collect the data that i have entered in that fragment. I know i could code the buttons into the fragment to make it easier on myself, but then again i'll still have to pass on the data at some point. – glendunbar Jun 02 '16 at 09:52
  • some design issue.. not coding i think – Sush Jun 02 '16 at 11:38
  • How can it be a design issue if i haven't wrote anything yet? I'm just looking to see if someone can explain the datapass interaction to me. If i'm requesting data from the fragment, – glendunbar Jun 03 '16 at 11:44

0 Answers0