Click here to Skip to main content
Click here to Skip to main content
Technical Blog

Tagged as

Android meets .NET !!!

, 22 Aug 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
It is always fun for me to program in C# (besides C++). If so, how would I feel if I was able to program for Android in C#? You may be wondering what in the world I am talking about. Android development environment is all Java and open source stuff. How could this Microsoft thing fit onto it?Well, i

It is always fun for me to program in C# (besides C++). If so, how would I feel if I was able to program for Android in C#? You may be wondering what in the world I am talking about. Android development environment is all Java and open source stuff. How could this Microsoft thing fit onto it?

Well, it seems that some clever guys had huddled up and ported Mono for Android, developed .NET libraries for the Android SDK, and also supplemented it with a 'Mono for Android' project template in Visual Studio; and called it mono for android. Thus we end up writing C# code happily for Android.

After a bunch of installations, fire up your Visual Studio (2010) and you should be seeing a new project template 'Mono for Android' under C#.

Create a new 'Mono for Android' project, which by default comes with an activity - C# code.

Modified the orginal code to try starting a new activity from the default one.

The project layout for most of the part is similar to the native Android project. The layout resources files are named *.axml, and the strings.xml is really clean with named string constants with the ugly behind the scenes of ids and stuff in the Resource.designer.cs. The way to code is straight forward and needs no special explanation. A good to see thing for me was .NET coding style.

A similar set of addins and plugins have been developed for MonoDevelop too; although I did not try that.

It is really a wondrous thing to know, program and relish such an attempt. However, there are sad curves in the story:-

  • Mono for Android is available only for Windows (and Mac). It is not available for Linux.
  • The installation of the application from Visual Studio and application response for the few clicks is pig slow. It is not Visual Studio's fault. It seems Mono takes quite a bit of time for JITting. After each part of the code is JITed, the application response for that part is fairly ok, but as good as Android's native\custom VM Dalvik.
  • The trial version does not allow deploying on the device. You can play around and deploy only on the emulator. If you want to use it on the device, it costs. Yes, it costs somewhere between $400-2500, depending on the licesing and support. Pretty expensive!

Try it out (the trial one or the full version if you are rich), at least for fun!

License

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

Share

About the Author

Vivek Ragunathan
Software Developer (Senior)
United States United States
No Biography provided

Comments and Discussions

 
QuestionMono for Android PinmemberFrom X20-Oct-11 21:01 
GeneralMy vote of 4 PinmemberBrianBissell30-Aug-11 5:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141216.1 | Last Updated 22 Aug 2011
Article Copyright 2011 by Vivek Ragunathan
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid