Android fragments - How to get an Activity widget

Android Fragments FAQ: How do I access an Activity widget from an Android Fragment?

All you have to do in your Fragment code is use the getActivity method to get a reference to your Activity, and then the usual findViewById method to get a reference to your widget:

// get a reference to the widget
EditText ilfsTextArea = (EditText)getActivity().findViewById(;

// set the desired text
ilfsTextArea.setText("<Enter your ILF names, press calculate>");

As you can see, once you have a reference to your widget, in this case an EditText field, you can work on it as usual.