Home > Article > Backend Development > C# uses Xamarin to develop applications -- switching activities
Usually each Activity corresponds to 1 Layout. Specify the layout during onCreate (otherwise it still refers to the main layout), and then call startActivity:
protected override void OnCreate (Bundle bundle) { SetContentView (Resource.Layout.UserRegister); base.OnCreate (bundle); // Create your application here var btnBack = FindViewById<Button> (Resource.Id.btnUserRgst_Back); btnBack.Click += (object sender, EventArgs e) => { StartActivity(typeof(MainActivity)); }; }
If you want to pass Value, you can use intent:
var intent = new Intent(this, typeof(UserRegister)); StartActivity(intent);
The above is the content of C# using Xamarin to develop applications--switching Activity. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!