2

I just want to use getActivity().data in my fragment to pull in the data object. It's not working though. Eclipse says that data cannot be resolved.

It looks like there is plenty of information about how to use Bundle to do this.

However, I am wondering how to use getActivity in particular.

Nathan Fowler
  • 561
  • 5
  • 19

1 Answers1

1

Although using Bundle is the preferred way and following way must be avoided but just to answer your question, try making the data variable static and access it by typecasting the activity ((YourActivity)getActivity()).data.

Ankit Bansal
  • 1,801
  • 17
  • 34