Achindra Bhatnagar
Published © MIT

Android App with Xamarin on Mac

A quick Android app development with Xamarin in C# on Mac.

EasyFull instructions provided1 hour970
Android App with Xamarin on Mac

Things used in this project

Software apps and online services

Visual Studio 2015
Microsoft Visual Studio 2015
Xamarin
Xamarin

Story

Read more

Code

Code Behind File

C#
Main function from code behind
 using Android.App;
 using Android.Widget;
 using Android.OS;
 using System;
 
 namespace TipCalculator
 {
     [Activity(Label = "Tip Calculator", MainLauncher = true, Icon = "@mipmap/icon")]
     public class MainActivity : Activity
     {
         EditText inputBill;
         Button cmdCalculate;
         TextView outputTip;
 
         protected override void OnCreate(Bundle savedInstanceState)
         {
             base.OnCreate(savedInstanceState);
 
             // Set our view from the "main" layout resource
             SetContentView(Resource.Layout.Main);
 
             inputBill = FindViewById<EditText>(Resource.Id.edittext1);
             cmdCalculate = FindViewById<Button>(Resource.Id.button1);
             outputTip = FindViewById<TextView>(Resource.Id.textView3);
 
             cmdCalculate.Click += onCalculateClick;
         }
 
         void onCalculateClick(object sender, EventArgs e)
         {
             var bill = double.Parse(inputBill.Text);
             outputTip.Text = (bill * 0.05).ToString();
         }
     }
 } 

Deployment Error

Plain text
Deploying package to 'emulator-5554'

The package does not support the device architecture (x86). You can change the supported architectures in the Android Build section of the Project Options.

Deployment failed. Architecture not supported.

Credits

Achindra Bhatnagar

Achindra Bhatnagar

20 projects • 128 followers
Windows Kernel Hacker, IoT Hobbyist, Enthusiast, Developer and Dreamer

Comments