Android meets .NET

It is always fun to program in C# (besides C++). If so, how would I feel if I was able to program in C# on Android? 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 guys1 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. Thus we relish writing C# code for Android.

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

Create a new Mono for Android project4, 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.

Such an attempt – programming in C# on Android, is really a wondrous thing. However, there are sad curves in the story:-

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