Sunday, 30 October 2016

Hello World Example Android Xamarin Using C#.Net

10/30/2016 - By Pranav Singh 0

This article will show you how you can create a very simple hello world android app example using Xamarin by visual studio 2013 and by language c#.net.

So for this article first we will open visual studio and click on “New Project”


After this a new window will open. In this window we will select the “Blank App” and rename the project.


After this we will go to solution explorer and we will get the below mention window.


Here is the code for the Activity which perform the operation.

using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace HellloWorld
{
    [Activity(Label = "HellloWorld", MainLauncher = true, Icon = "@drawable/icon")]
    public class MainActivity : Activity
    {
        int count = 1;

        protected override void OnCreate(Bundle 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++); };
        }
    }
}

After this we will learn how we can start the emulator to check the output of the of the application which we have developed.

So for this we will go to Tools-> Android -> Android Emulator Manager. After this a window will open.



After this we will select the emulator and click on “Start” button to open the emulator. After this your emulator will open.



Now to check the emulator of to check the output.



After this your application output will get displayed in your emulator.





About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Global Classified : Connectseekers.com
© 2014 aspdotnet-pools.com Designed by Bloggertheme9.
back to top