Skip to content

Latest commit

 

History

History
9 lines (6 loc) · 517 Bytes

android-fragments-communication.md

File metadata and controls

9 lines (6 loc) · 517 Bytes

title: Android: Fragments: Communicating between FragmentActivity and Fragment date: 2012-03-24 12:29:13 tags: android,android-fragments

In your FragmentActivity, you can call getSupportFragmentManager().findFragmentByTag(“tag”), or findFragmentById(R.id.frag), to access the child Fragment. From there you can call its methods.

Similarly, in the Fragment, you can call getActivity() to get access to the parent FragmentActivity().

You can also do this via events. See the android-fragments-events post.