building your first android app with xamarin

31

Upload: xamarin

Post on 06-Apr-2017

145 views

Category:

Software


3 download

TRANSCRIPT

university.xamarin.com

Microsoft: Your Complete Mobile Solution

Deploy to emulator

and device

iOS

Xamarin’s unique approach

Shared C# codebase • 100% native API access • High performance

Windows C# UI

What is Xamarin.Android?

C# source Native execution

Mono and ART VMs run side-by-side to execute a Xamarin.Android app

Xamarin.Android execution

Android

Runtime (ART)

Mono

Runtime

Linux Kernel

android.*

libraries

java.*

libraries

.NET

libraries

Your

IL code

Xamarin.Android – 100% API coverage

Text-to-speech Toolbar Printing Framework Renderscript NFC

System.Data System.Collections System.Numerics System.Core System.ServiceModel

System.Net System System.IO System.Linq System.Xml

C#

Always up-to-date

Full support for all Android versions

Xamarin Platform support

Broad support for Android devices, including

phones, tablets, Android Wear and Amazon Fire TV

Open Source – open.xamarin.com

Develop on Mac or Windows

Microsoft Visual Studio

on Windows

Visual Studio for Mac

on macOS (preview)

Development workflow

Activities: a collection of collaborating parts that

comprise Android apps

App structure

Activity 1

UI

Code

Activity 2

UI

Code

Activity 3

UI

Code

Data files,

images, etc.

MyApp

Activity definition

<LinearLayout ... ><TextView ... ><EditText ... ><Button ... ><TextView ... >

</LinearLayout>

Pi.axml

[Activity]public class PiActivity : Activity{...SetContentView(Resource.Layout.Pi);

}

PiActivity.cs

An XML layout file

that defines the UI

The related C# class

provides the behavior

Integrating .NET Libraries

You can integrate

your shared

business logic

packaged as a PCL

You can use JNI or a Bindings Library to incorporate Java libraries into your

Xamarin.Android app

Integrating Java Libraries

PayPal TritonPlayerArcGIS ...

Mapping Finance Music

Set the ID of a View in XML using the id attribute and the syntax @+id/

Access UI from code

<EditText android:id="@+id/digitsInput" ... />Set an id

in the XMLprotected override void OnCreate(Bundle bundle){

base.OnCreate(bundle);SetContentView(Resource.Layout.Pi);

var et = FindViewById<EditText>(Resource.Id.digitsInput);et.TextChanged += OnTextChanged;

}

Lookup

in code

Xamarin.Android UI is

built from Google’s

controls and layout

panels, wrapped in C#

by Xamarin

Android UI

Get fully native look and

feel with native controls

Native UX

Visual Studio provides

a UI Designer on

Windows and macOS

UI Designer

Get Started Todayxamarin.com/download

Free self-guided courses

Thank you

@flyinggeekette

[email protected]

Q&A

Samples available at:

https://aka.ms/raz619