Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Mobile / Xamarin

Android on Visual Studio

3.53/5 (29 votes)
18 Mar 2015CPOL2 min read 70.6K  
Develop Android applications using Visual Studio and C#

1. Xamarin Project

Xamarin is a project for building cross-platform applications. What is really nice is that it uses C# and Visual Studio 2013, the perfect combination for most .NET developers! It is now possible to use Visual Studio to build applications for Android and iOS. In fact, Xamarin has its own IDE, which is Xamarin Studio. And, it could be installed in Visual Studio as an extension to benefit from all of its powerful tools.

2. Download Xamarin

A 1 month trial version is available for download. MSDN subscribers have a better chance to try the full version for 30 days.

A good news has come out on March 19th, there will be a free version for open source projects contributors where you may apply here.

3. Getting Started

To create an Android application in Visual Studio, select New Project -> Android, then chose the API version you want. Choosing “Android application” will create a project targeting API level 10. It’s possible to download and install other SDK levels.

The created project seems to be an ordinary Android project, except that the Activity object is now a C# class and project references to .NET and Mono libraries.

The design of the UI could be done with Drag and Drop. The Toolbox window contains almost all common Android controls. The Properties window contains all selected controls’ properties.

Image 1

Figure shows editing Android UI with Visual Studio 2013

4. Advantages of Xamarin

In addition to using Visual Studio features like IntelliSense, Nuget, Code Map, it’s also possible to use Portable Class Library (PCL) to target multiple platforms including iOS and Android. Also, Nuget makes it easy to install useful packages as Json.net, HTTP Client Libraries or even Sqlite.net.

Xamarin provides access to each platform specific features to benefit from a native experience, which is not possible with HTML5.

5. Conclusion

.NET developers got the advantage to start developing Android and iOS applications using their skills with C# and Visual Studio, with no need to learn two new languages. To go further, well documented tutorials are available on docs.xamarin.com.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)