Welcome World - First Android Application in Visual Studio 2010

Before beginning development of your first Android application you should check that the Android SDK is installed or not and an Android emulator (AVD) has been created. To see all the installation information please see my previous article What is Android and How to Install it for Visual Studio 2010, and return here when you've completed the installation. 


Mono for Android 1.0 is a framework for third-party developers to build native Android applications in C#. It brings the full Mono VM to Android. We use a library profile that is better suited for mobile devices, so features that are not necessary (like the entire System.Configuration stack, just like Silverlight does) have been removed. 

 Following are the features of Mono for Android:
  • C# and .NET on Android phones and tablets
  • Enterprise deployable platform
  • .NET Bindings to Native APIs
  • Visual Studio 2010 Integration feature
In this tutorial we use Visual Studio 2010 and the C# language because Android is an open source implementation of Microsoft's .Net Framework based on the ECMA standards for C# and the Common Language Runtime. It enables developers to use Microsoft Visual Studio to create C# and .NET based applications that run on Android phones and tablets. Developers can use their existing skills and reuse code and libraries that have been built with .NET, while taking advantage of native Android APIs. 

Let's create a new Android Project using Mono:
  • Step 1: Open Visual Studio, select File / New / Project.

    1.gif

  • Step 2: After installing the Android plug-in for Visual Studio the dialog for Android should be in Visual C# / Mono for Android category choose that and select "Mono for Android Application". Give the name for your application like "welcomeworld" and click on OK.

    2new.jpg

    Now your project is ready. By default it contains a single Activity file named Activity1.cs, it is simply a class and used as the basis for an application. The Activity1.cs file will look like this:

    3new.jpg

  • Step 3: Just run the application to check that everything is working correctly.

    Click "Start emulator image" and choose MonoDroid and click OK.

    4.gif

    5.gif

    Now it will ask to choose the emulator. So, select the emulator and click ok.

    selctemulator.gif
  • Step 4: The output window will look like this:

    6.gif

Happy Learning


Similar Articles