C # cross-platform mobile app development tool Xamarin tries a simple comparison with eclipse

Source: Internet
Author: User

Xamarin supports the development of Android-based, IOS, windowsphone applications using C #, with the greatest features c#+ cross-platform, detailed explanation of the Niang.

Installation Research

Want to experience Research click View Page Xamarin for Visual Studio 3.0.54.0 full offline cracked version

I also downloaded the research, crack sometimes have a problem, a landing will become a trial version, need to regenerate license, quite annoying, so write a batch of processing, put into Notepad save as Crack.bat execution, you can generate license again.

@Entitlements. bak is the entitlements file that was generated after the hack, the login will be deleted, so I changed the name to save the directory in copy "C:\ProgramData\Mono for android\license\ Entitlements.bak "" C:\ProgramData\Mono for Android\license\entitlements "/y;copy" C:\ProgramData\MonoTouch\License\ Entitlements.bak "" C:\ProgramData\MonoTouch\License\Entitlements "/y;@ the following 2 lines for Android and iOS development generate License" C:\Program Files\msbuild\xamarin\android\mandroid.exe "-activate-activation-name=b4a-activation-phone=q-activation-company =b4a-activation-code=q-activation-email=q; " C:\Program Files\msbuild\xamarin\ios\mtouch.exe "-activate-activation-name=b4a-activation-phone=q- activation-company=b4a-activation-code=q-activation-email=q;

I installed the computer vs2010+vs2013,xamarin in vs2010 more normal, on the vs2013 update2 on the cross-platform application (Android+ios) when the vs2013 will not respond to death, not normal use. The following steps will work correctly

1, open vs2013, Tools--xamarin account landing--into the trial version
2. Open cross-platform solution in VS
3, tool--xamarin account cancellation logout
4, Execute bat: Automatically copy cracked entitlements, automatically generate license
5. Tools--Xamarin account popup landing box canceled several times--into Enterprise Edition


Now you can encode it properly, and be careful not to log in again.

Use

Code structure

vs2013 vs Eclipse is actually the same

Activity Code Comparison

usingSystem;usingAndroid.app;usingandroid.content;usingAndroid.runtime;usingandroid.views;usingAndroid.widget;usingAndroid.os;namespacehellodroid{[Activity (Label="hellodroid", Mainlauncher =true, Icon ="@drawable/icon")]     Public classmainactivity:activity {intCount =1; protected Override voidOnCreate (Bundle bundle) {Base.            OnCreate (bundle); //Set Our view from the "main" layout resourceSetcontentview (Resource.Layout.Main); //Get Our buttons from the layout resource,//And attach an event to itButton button = findviewbyid<button>(Resource.Id.MyButton); button. Click+=Delegate{button. Text =string. Format ("{0} clicks!", count++);        }; }    }}
View Code
 PackageCom.example.helloworld;Importandroid.app.Activity;ImportAndroid.os.Bundle;ImportAndroid.view.Menu;ImportAndroid.view.MenuItem; Public classMainactivityextendsActivity {@Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate);    Setcontentview (R.layout.activity_main); } @Override Public BooleanOncreateoptionsmenu (Menu menu) {//inflate the menu; This adds items to the action bar if it is present.getmenuinflater (). Inflate (R.menu.main, menu); return true; } @Override Public Booleanonoptionsitemselected (MenuItem item) {//Handle Action Bar item clicks here. The Action Bar would//automatically handle clicks on the Home/up button, so long//As you specify a the parent activity in Androidmanifest.xml.        intID =Item.getitemid (); if(id = =r.id.action_settings) {            return true; }        return Super. onoptionsitemselected (item); }}
View Code

Layout layouts File Comparison

<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"android:orientation= "vertical"Android:layout_width= "Fill_parent"Android:layout_height= "Fill_parent">    <ButtonAndroid:id= "@+id/mybutton"Android:layout_width= "Fill_parent"Android:layout_height= "Wrap_content"Android:text= "@string/hello" /></LinearLayout>
XAML
<Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Android:paddingbottom= "@dimen/activity_vertical_margin"Android:paddingleft= "@dimen/activity_horizontal_margin"Android:paddingright= "@dimen/activity_horizontal_margin"Android:paddingtop= "@dimen/activity_vertical_margin"Tools:context= "Com.example.helloworld.MainActivity" >    <TextViewAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "@string/hello_world" /></Relativelayout>
java XML

UI Designer

VS2013 support for dragging controls

Eclipse

Summary after personal use

Developing Android apps in Xamarin is similar to developing Android apps in Java, with almost the same directory structure and similar code. Layout is the same way that controls are as many as controls in eclipse. Packaged apk app slightly larger (write a click button Count program app, support Android 2.2+,apk size 3.7M, because the internal contains mono runtime so larger).

Android apps developed with Xamarin are executing quickly, as do C # development applications in the Android emulator, which is slightly faster than Java Native, and does not differ from native applications in mobile phones. Samsung Note2 is faster than native applications developed in Java (from foreign articles). Have time to write a program carefully compared to the next.

If you just develop Android applications, or suggest using Java+eclipse, after all, is the orthodox official, open Source Library More, help support more, and C # and Java are very similar, learn quickly and not difficult. There are certain limitations and individual unresolved problems with xamarin development, and there is no such problem with Java development.

Xamarin applies to cross-platform development (business logic, data access part can be reused across platforms), applies to C # 's don't want to learn Java or object C, compared to iOS development (after all, from C # or Java to object C span a bit large)

C # cross-platform mobile app development tool Xamarin tries a simple comparison with eclipse

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.