Manoj Kumar Baghel
Manoj Kumar Baghel

Reputation: 96

How to convert an iOS MonoTouch application into an Android version using Mono for Android?

We have heard about the possibility to develop in C# on iOS and Android platforms using MonoTouch and Mono for Android

http://xamarin.com/monoforandroid

I have an iOS MonoTouch application that I would like to convert into a Mono for Android version. How would a simple example, like the piece of code below, translate into Mono for Android?

using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace HelloWorld_iPhone
{
    public class Application
    {
        static void Main (string[] args)
        {
            UIApplication.Main (args, null, "AppDelegate");
        }
    }
}

Upvotes: 1

Views: 674

Answers (1)

jonathanpeppers
jonathanpeppers

Reputation: 26505

There is no use of a static void Main() method in Mono for Android. You basically have a "Main" activity that starts your app.

Here is an example of this:

[Activity (Label="My App", MainLauncher=true)]
public class MyActivity : Activity
{

}

This then generates the appropriate Android manifest file to launch the app. See here.

I would just use File->New Project->Mono for Android App and use what the template generates.

Upvotes: 1

Related Questions