Mono for Android, C # for Android, and monodroid-[Hello, monoandroid]

Source: Internet
Author: User
Tags asp net
First, let's know what Mono is: Mono is an open-source project launched by Novell (initiated by ximian and led by Miguel de lcaza) to create. Net on Linux. It contains a C # Language compiler, a clr runtime, and a group of class libraries, and implements ado net and asp net. Allows developers to use C # For Development in LinuxProgram.)
Mono is now licensed by Novell, and QT is similar to Mozilla Application Suite. Mono's C # compiler and related tools are released under GNU General Public License (GPL), and its Runtime Library is released under GNU lesser General Public License (lgpl, its Class Library is released under mit license. These are open-source protocols, so Mono is an open-source software. If you are planning to contribute your source code to mono, you must sign a Copyright assignment to Novell to allow itCodeApply for a license under another agreement, This allows Novell to retain its dual-licensing capability to hold mono commercial agreements.
The mono Virtual Machine contains a Real-Time compilation engine that can be used for the following processors: x86, iSCSI, PowerPC, arm, s390 (32-Bit mode and 64-Bit mode), x86-x64, the names of the 64-bit and IA64-bit. this virtual machine can compile or pre-compile the code to the native code in real time. For systems that are not listed, the Code interpreter is used.
For more information, see.

Then we can see that mono for Android, MFA is a mono Virtual Machine for Android, allowing developers Use C # To develop Android applications . In addition, the Dalvik API has been bound to C #. You can use C # To conveniently call many built-in Android class libraries. The opentk class library is also transferred. You can share the same OpenGL code on three different platforms, windows, Linux, and iPhone. It is worth noting that, unlike the mono open source, the use of mono for Android requires authorization, and the cheapest for student requires 99 knives, unless you are developing on a simulator alone.


I wanted to try mono for Android tonight and use C # To write an android applet. But how can I not connect to monodevelop.com on the campus network in this tragedy? Download the tool first, record the process of self-matching environment and personal views on mono for Android.
First, record the installation process of mono for Android SDK. There are two ways to install MFA. The first is to update the plug-in directly on monodevelop, another kind of installation is in the form of Visual Studio plug-ins. I originally wanted to install it directly on monodevelop to avoid the bloated Visual Studio, the results showed that the mono update server could not be connected to the campus network environment, and the development process could only be tried using the Visual Studio plug-in.

The installation is simple, as long as the following four simple steps:
    • 1. Install the Java SDK
    • 2. Install the android SDK
    • 3. Configure your simulator
    • 4. Install the mono for Android Visual Studio 2010 plugin

The Java SDK should be installed. If not, click Download and install. Next, install the android SDK. Installing the android SDK is a headache, especially on the campus network. It is very slow to install it online through installer, fortunately, you copied the downloaded SDK directly on your PC and click Download and install.
Configure the android simulator, open the SDK manager in the downloaded SDK folder, and create a new visual device.

Finally, install monodroid for Visual Studio and click Download. Remember to close all open Visual Studio windows during installation. By now, the basic environment has been configured. Open Visual Studio and you will be able to see the options for creating mono for Android.


The next step is my "Hello, monoandroid" demo.
Open Visual Studio to create a project. We can see that we chose a "mono for Android Application ".


Enter the project name, OK.

The automatically generated code is displayed:

Using System;
Using Android. app;
Using Android. content;
Using Android. runtime;
Using Android. views;
Using Android. widget;
Using Android. OS;
Namespace Hellomonoandroid
{
[Activity (Label = " Hellomonoandroid " , Mainlauncher = True , Icon = " @ Drawable/icon " )]
Public Class Activity1: Activity
{
Int Count = 1 ; Protected Override Void Oncreate (bundle)
{
Base . Oncreate (bundle );
// Set our view from the "Main" layout Resource

Setcontentview (resource. layout. Main );
// Get our button from the layout resource,
// And attach an event to it

Button button = Findviewbyid < Button > (Resource. Id. mybutton );
Button. Click + = Delegate {Button. Text = String . Format ( " {0} clicks! " , Count ++ );};
}
}
}


Are you familiar with and unfamiliar with it. This requires some background knowledge about Android. Although we use C # To develop Android applications, we also need to know the composition and framework of Android programs, android applications are constructed by four modules: Activity, intent, content provider, and service. Activity is the most basic module. An activity is usually a single screen. For more information, see related books. The Code generates a button, click the button to display the cumulative number of clicks.
Let's look at the resource manager:

Mono is referenced. android namespace, which is the basis for mono for Android implementation. There are also several folders. People who have been familiar with Android development may feel very familiar with it. drawable is used to place image resources, like background images and icons. layout is a layout file with a string in values. XML, which can define strings.
This is a basically runable mono for Android program.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.