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