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”
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.
0 comments:
Please let me know your view