protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); newgame = new PigLogic(); Toast.MakeText(this, player1Text, ToastLength.Long).Show(); var startButton = FindViewById <Button>(Resource.Id.startButton); startButton.Click += delegate { player1 = FindViewById <EditText>(Resource.Id.player_one); player2 = FindViewById <EditText>(Resource.Id.player_two); player1Text = player1.Text; player2Text = player2.Text; newgame.player1Name = player1Text; newgame.player1Name = player2Text; Intent secondActivity = new Intent(this, typeof(SecondActivity)); secondActivity.PutExtra(PLAYER1, player1Text); secondActivity.PutExtra(PLAYER2, player2Text); StartActivity(secondActivity); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SecondActivity); PigLogic newgame = new PigLogic(); TextView player1 = FindViewById <TextView>(Resource.Id.player1Text); TextView player2 = FindViewById <TextView>(Resource.Id.player2Text); string p1 = Intent.Extras.GetString(MainActivity.PLAYER1); string p2 = Intent.Extras.GetString(MainActivity.PLAYER2); Toast.MakeText(this, "fdsfs", ToastLength.Long).Show(); player1.Text = p1; player2.Text = p2; }