protected CustomDialogInfo CreateDialog(int layoutId, string dialogTag, string title = null) { FragmentTransaction ft = FragmentManager.BeginTransaction(); //Remove fragment else it will crash as it is already added to backstack Fragment prev = FragmentManager.FindFragmentByTag(dialogTag); if (prev != null) { ft.Remove(prev); } ft.AddToBackStack(null); // Create and show the dialog. CustomDialogFragment dialog = CustomDialogFragment.NewInstance(layoutId, null); //Add fragment //newFragment.Show(ft, "dialog"); return(new CustomDialogInfo { Dialog = dialog, DialogTag = dialogTag, FragmentTransaction = ft }); }
public static CustomDialogFragment NewInstance(int fragmentId, Bundle bundle) { CustomDialogFragment dialog = new CustomDialogFragment(fragmentId); dialog.Arguments = bundle; return(dialog); }