Code example for Fragment

Methods: getActivity, getLoaderManager, onActivityCreated

0
        setHasOptionsMenu(true);
    } 
 
    @Override 
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
 
        if (mCompanyUri == null) {
            return; 
        } 
 
        if (getActivity() instanceof ImageLoader.ImageLoaderProvider) {
            mImageLoader = ((ImageLoader.ImageLoaderProvider) getActivity()).getImageLoaderInstance();
        } 
 
        // Start background query to load sandbox company details 
        getLoaderManager().initLoader(SandboxQuery._TOKEN, null, this);
    } 
 
    @Override 
    public void onAttach(Activity activity) {
        super.onAttach(activity);