This question has already been answered:

Guys need help ... in MainActivity I get data about my location ... how do I transfer this data to the fragment or how can I get this data from the activator in the fragment for further use?

Reported as a duplicate by pavlofff android Jan 12 '17 at 1:29 pm

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

1 answer 1

From the fragment, you can get the appropriate actions by calling the getActivity() method. In this activity, create a method to get these coordinates and call it after getActivity() . Here is an example .

  • can you give an example of this? getting any method via getActivity - elik
  • Added an example. - Arnis Shaykh