コード例 #1
0
        public static DialogFragment1 NewInstance(Bundle bundle)
        {
            DialogFragment1 fragment = new DialogFragment1();

            fragment.Arguments = bundle;
            return(fragment);
        }
コード例 #2
0
        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");
        }