I saw a lot of posts about the communication between fragments and activity. I chose to create getters and setters in my activity so i can get and set the data i want to share in my 3 tabs.
But when i use getActivity.getData(); i got a "The method getData() is undefined for the type FragmentActivity" message.
I use getActivity in the onAttach() method.
Thank you for reading
usually this happens because the getActivity() does not have to return your "Main" Activity. If your Activity is called "MainActivity" the cast it just like this:
(MainActivity)getActivity().getData();
Hope this helps ;)