public static CustomDialogFragment NewInstance(Bundle bundle, string textMessage) { _textMessage = textMessage; CustomDialogFragment fragment = new CustomDialogFragment(); fragment.Arguments = bundle; return(fragment); }
public void Show(MainScreenActivity obj, string textMessage) { FragmentTransaction ft = obj.FragmentManager.BeginTransaction(); //Remove fragment else it will crash as it is already added to backstack Fragment prev = obj.FragmentManager.FindFragmentByTag("dialog"); if (prev != null) { ft.Remove(prev); } ft.AddToBackStack(null); // Create and show the dialog. CustomDialogFragment newFragment = CustomDialogFragment.NewInstance(null, textMessage); //Add fragment newFragment.SetListener(obj); newFragment.Show(ft, "dialog"); }