Code example for Fragment

Methods: getActivity, onCreate, setRetainInstance