OdeToCode IC Logo

MonoDroid Preview

Tuesday, January 11, 2011

MonoDroid allows you to write Android applications using C# and Visual Studio.

Compare the code in the last post to the following:

[Activity(Label = "My Activity", MainLauncher = true)]
public class Activity1 : Activity
    protected override void OnCreate(Bundle bundle)

        Button button = FindViewById<Button>(Resource.id.button);
        TextView view = FindViewById<TextView>(Resource.id.text);

        button.Click += (s, args) => view.Text = "Clicked!";
        button.LongClick += (s, args) =>
                                    view.Text = "Long click!";
                                    args.ReturnValue = false;

MonoDroid looks promising. It does all the hard work of mapping Android APIs and idioms into a proper C# representation (notice how the long click Java listener in the last post returns a value, while the long click C# event handler in this post sets a flag in the event arguments). It's little touches like these that make a difference.

MonoDroid also includes a Visual Studio plugin to deploy and debug on the Android simulator, or a real device (even over Wifi). That's a lot of great magic behind the F5 button.

Gravatar jmorris Tuesday, January 11, 2011
I just joined the preview program and can't wait to try out monodroid.

I have been using Eclipse for droid development and can say it doesn't compare to VS: speed, ease of use, debugging, intellisense, etc. While Java is a very capable language, it's like going back in time to C# 1.0...no anonymous properties, lambda expressions, et al. It's amazing how far C# has come...

Gravatar scott Wednesday, January 12, 2011
@Jeff - I couldn't agree more. C# has really come a long way.
Comments are closed.