Question: How do I pass objects from fragment to activity (on request from activity).
Background: I am using Android Studio and have set up a new tabbed activity from the New Android Activity wizard. I have then defined 5 fragments that each contain different sets of inputs (edit texts and so on). Each input form then populates a custom object so that it can be passed to the tab host activity. I will then save the objects in a database once an 'Add button' is pressed on the task bar (this is where the objects should be taken in from fragments). However I cannot find a way to pass the objects from the fragments to the activity. Previously I have passed objects between activities by using and calling a 'getObject()' method, this doesn't seem to work for the fragments.
My fragments do not currently have an 'onAttach' method, I'm not too sure what this does.
Thanks in advance for any help.