Code example for DialogFragment

Methods: onAttach

0
        setRetainInstance(true);
    } 
     
    @Override 
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        try { 
            callbacks = (ReleaseSelectionCallbacks) activity;
        } catch (ClassCastException e) {
            throw new ClassCastException(activity.toString() + " must implement "
                    + ReleaseSelectionCallbacks.class.getSimpleName());
        } 
    } 
     
    @Override 
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        release = callbacks.getReleasesInfo();
        if (release != null) {
            releaseList.setAdapter(new ReleaseInfoAdapter(getActivity(), R.layout.list_release, release));
        }