From the course: Xamarin Essential Training: Create Your First App

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Work with native UI elements

Work with native UI elements

- [Instructor] Now that we've got our application created let's take a closer look at this MainActivity that was created for us. You'll notice on line nine, it derives from AppCompatActivity, and that's what helps us hook up our C# code here with the underlying Java and Android frameworks. It's that Xamarin layer that connects the two. On line eight you'll notice we're still using C# with our attributes. We've got an activity attribute on there that says, hey, this class is an activity. It's got a label, there's a theme to be applied, and we indicate that it's the main launcher, meaning when we run the application or launch it this is the MainActivity that's going to start up. And we'll come back to the syntax of the label. We're accessing a string called app_name to provide that label. We've got a method called OnCreate where we set up everything. This is our initialization of the activity. And since this is the…

Contents