diff options
Diffstat (limited to 'examples/csharp/HelloworldXamarin/Droid/MainActivity.cs')
-rw-r--r-- | examples/csharp/HelloworldXamarin/Droid/MainActivity.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/csharp/HelloworldXamarin/Droid/MainActivity.cs b/examples/csharp/HelloworldXamarin/Droid/MainActivity.cs new file mode 100644 index 0000000000..20982422f2 --- /dev/null +++ b/examples/csharp/HelloworldXamarin/Droid/MainActivity.cs @@ -0,0 +1,27 @@ +using Android.App; +using Android.Widget; +using Android.OS; + +namespace HelloworldXamarin.Droid +{ + [Activity(Label = "HelloworldXamarin", MainLauncher = true, Icon = "@mipmap/icon")] + public class MainActivity : Activity + { + int count = 1; + + protected override void OnCreate(Bundle savedInstanceState) + { + base.OnCreate(savedInstanceState); + + // Set our view from the "main" layout resource + SetContentView(Resource.Layout.Main); + + // Get our button from the layout resource, + // and attach an event to it + Button button = FindViewById<Button>(Resource.Id.myButton); + + button.Click += delegate { button.Text = $"{count++} clicks!"; }; + } + } +} + |