protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait; RequestWindowFeature(WindowFeatures.NoTitle); Context mContext = Application.Context; Typeface localTypeface = Typeface.CreateFromAsset(mContext.Assets, "fonts/china1.ttf"); // Set our view from the "main" layout resource SetContentView(Resource.Layout.MainScreen); tableLayout = FindViewById <TableLayout>(Resource.Id.tablelayout); buttonNewGame = FindViewById <Button>(Resource.Id.btnNewGame); buttonNewGame.SetTypeface(localTypeface, TypefaceStyle.Normal); buttonNewGame.SetTextColor(Color.White); buttonNewGame.SetOnClickListener(this); buttonMainScreen = FindViewById <Button>(Resource.Id.btnMainScreen); buttonMainScreen.SetTypeface(localTypeface, TypefaceStyle.Normal); buttonMainScreen.SetTextColor(Color.White); buttonMainScreen.SetOnClickListener(this); txtViewCount = FindViewById <TextView>(Resource.Id.txtvwCount); txtViewCount.SetTypeface(localTypeface, TypefaceStyle.Normal); typeGame = Intent.GetStringExtra("TypeGame"); BuildGameField(); MainScrActivity = this; }
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"); }