tyb tyb - 28 days ago 16
Android Question

Passing data between a fragment and its container activity

How can i pass data between a fragment and its container activity? Is there something similar to passing data between activities through intents?

I read this: http://developer.android.com/guide/topics/fundamentals/fragments.html#CommunicatingWithActivity

But it didn't help much.
Any help is appreciated

Answer

In your fragment you can call getActivity(). This will give you access to the activity that created the fragment. From there you can obviously call any sort of accessor methods that are in the activity.