Q: Dialog disappears on rotation In my application, I have a custom dialog that is called from the user clicks on "About" menu item.
 public class AboutDialog extends Dialog {
    ...
 ?

 ...
 AboutDialog dlg = new AboutDialog(ctx);
 dlg.show();

My app has two activities. About menu item is available in both the activities.
In the first activity, if the device is rotated while the dialog is displayed, it continues to stay displayed. However, in the second activity, the dialog disappears on rotation.
I don't have any logic to bring the dialog up on rotation. The framework makes this happen automatically.
I am wondering if anyone has any thought on why the dialog might disappear in the second activity.

A: Dialog will be closed since the activity is recreated on screen orientation change. adding the android:configChanges="orientation" on your activity in manifest may be able to solve the problem but is not recommended. Best solution is to use fragmentDialog. Here's a sample to call a fragment dialog:
private void showFragmentDialog() {
        FragmentManager fm = getChildFragmentManager(); //THIS IS USED WHEN YOU ARE NOT INSIDE AN ACTIVITY FRAGMENT else use getFragmentManager
        DialogFragmentName dialog_fragment = new DialogFragmentName();
        dialog_fragment.show(fm, "dialog_fragment");
    }

And this will be your FragmentDialog Class:
public class DialogFragmentName extends DialogFragment {
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.YOUR_DIALOG_LAYOUT, container);
        //SETUP YOUR VIEWS HERE E.G.:
        //Button btn = (Button) view.findViewById(R.id.VIEW_ID);

        return view;
    }
}

And change your extend into FragmentActivity instead of just an ordinary Activity to make this work.
