Handling user interactions
User interaction is the most important aspect of developing a mobile application. A mobile app should be interactive and easy to use.
In this basic application, we will be writing our user interaction code in C# and it will be part of the MainActivity.cs file:
- Let's click on the
MainActivity.csfile from theSolution Exploreron the left and open it:

It has some autogenerated code that we are going to modify in order to make our application work.
- We need to write our code inside the
OnCreate()method of theMainActivity.csfile:

Before we start writing user interaction code, let's understand the autogenerated code first:
base.OnCreate(savedInstanceState);
This piece of code calls the OnCreate() method of the parent/base class of MainActivity.cs, which is Activity.cs.
SetContentView(Resource.Layout.Main);
As the comments already say, it sets the view from our layout resource file, Main.axml.
We need to write our SetContentView(Resource.Layout.Mai) code.
- First, get a reference...