SIGN UP MEMBER LOGIN:    
ARTICLE

Welcome World - First Android Application in Visual Studio 2010

Posted by Manish Tewatia Articles | Android Programming May 23, 2011
This is a tutorial for developing your first Android application using Visual Studio 2010 and the C# language
Reader Level:

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

Login to add your contents and source code to this article
share this article :
post comment
 

hi sir, i have installed vs2010 and monodroid, but while running program i got error as " unhandled exception in Button_On_Click:Task".How to resolve this exception

Posted by poorni poorni Mar 21, 2012

hey manish, can u plz post the procedure on how to deploy the built monoandroid app to any android mobile phone.. thanks in advance

Posted by mahesh kumar B M Oct 11, 2011

Sorry for late reply... the IDE is visual studio 2010 and language you have to use c#...

Posted by Manish Tewatia Jul 13, 2011

ThanK you, No Friend must have VS2010....

Posted by Manish Tewatia Jul 13, 2011

thanks for posting this article for beginner. I have a question. i would like to know can i use VS 2008 instead of VS2010 in ur example?

Posted by Ivan Wong Jul 11, 2011
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor