com.robwilliamson.healthyesther.fragment.dialog.FixedDialogFragment.java Source code

Java tutorial

Introduction

Here is the source code for com.robwilliamson.healthyesther.fragment.dialog.FixedDialogFragment.java

Source

/**
  *  Robert Williamson 2014-2016.
  * This program is distributed under the terms of the GNU General Public License.
  */
package com.robwilliamson.healthyesther.fragment.dialog;

import android.app.Dialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

public class FixedDialogFragment extends DialogFragment {
    public FixedDialogFragment() {
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRetainInstance(true);
    }

    @Override
    public void onDestroyView() {
        Dialog dialog = getDialog();
        if (dialog != null && getRetainInstance()) {
            dialog.setOnDismissListener(null);
        }

        super.onDestroyView();
    }
}