i craete an android application with four buttons in the first interface and i need each button to open another screen when clicked i did it correctly with the first button using this code
- using Android.App;
- using Android.Widget;
- using Android.OS;
- namespace fitness_ghadi
- {
- [Activity(Label = "fitness_ghadi", MainLauncher = true , Icon ="@drawable/icon")]
- public class MainActivity : Activity
- {
- protected override void OnCreate (Bundle bundle)
- {
- base.OnCreate(bundle);
- // Set our view from the "main" layout resource
- SetContentView(Resource.Layout.Main);
- Button button = FindViewById
- button.Click += delegate {
- StartActivity(typeof(second));
- };
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Android.App;
- using Android.Content;
- using Android.OS;
- using Android.Runtime;
- using Android.Views;
- using Android.Widget;
- namespace fitness_ghadi
- {
- [Activity(Label = "second")]
- public class second : Activity
- {
- protected override void OnCreate(Bundle savedInstanceState)
- {
- base.OnCreate(savedInstanceState);
- SetContentView(Resource.Layout.Second);
- Button button = FindViewById
- button.Click += delegate {
- StartActivity(typeof(MainActivity));
- };
- // Create your application here
- }
- }
- }
Amit GuptaPosted Mar 28, 2018, 3:59 AM
raghad abdulahPosted Mar 28, 2018, 3:57 AM
Amit GuptaPosted Mar 28, 2018, 3:56 AM
raghad abdulahPosted Mar 28, 2018, 3:53 AM
Amit GuptaPosted Mar 28, 2018, 3:46 AM