SlideShare a Scribd company logo
1 of 75
Building your first Android app
using Xamarin
Gill Cleeren
@gillcleeren
Hi, I’m Gill!
Gill Cleeren
MVP and Regional Director
.NET Practice Manager @ Ordina
Trainer & speaker
@gillcleeren
gill@snowball.be
I’m a Pluralsight author!
• Courses on Xamarin, WPF, social and HTML5
• http://gicl.me/mypscourses
Agenda
• Overview of Xamarin and Xamarin.Android
• Xamarin.Android fundamentals
• Creating a detail screen
• Lists and navigation
• Navigating from master to detail
• Optimizing the application
• Preparing for store deployment
Targets of this talk
• Understanding the fundamentals of Android app development with
Xamarin
• See how a fully working app can be built
The demo scenario
• Android Coffee Store Manager
• List of coffees
• Navigation to details page
DEMO
Looking at the finished application
Overview of Xamarin and
Xamarin.Android
Hello Xamarin
• Xamarin enables developers to reach all major mobile platforms!
• Native User Interface
• Native Performance
• Shared Code Across Platforms
• C# & .NET Framework
• Toolset on top of Visual Studio
• Enables VS to create native iOS and Android apps
• Commercial product
Write Everything in C#
iOS, Android, Windows, Windows Phone, Mac
Billions of Devices covered!
The Xamarin platform
Xamarin
Xamarin.Android Xamarin.iOS Xamarin Forms
Xamarin.Android exposes many extra device
types
Xamarin.Android
Anything you can do in Java/Android can be done in C# and
Visual Studio (or Xamarin Studio) with Xamarin!
How Xamarin works on Android
• Mono VM + Java VM execute side-by-side (supports both Dalvik and
ART)
• Mono VM JITs IL into native code and executes most of your code
• Can utilize native libraries directly as well as .NET BCL
A word on code-sharing
• Xamarin brings development time through the use of code-sharing
• Possible (currently!) using
• Shared projects:
• allows organizing the shared code
• #if directives for platform specific code
• PCL
• “include” the platforms we want to support
• Abstract to interfaces where platforms have specific implementations
Target architecture for a Xamarin app
Preparing for
Android development
What you need for Xamarin.Android
development
• Xamarin license (Xamarin.Android)
• PC or Mac
• Visual Studio or Xamarin Studio
• Android SDK and Emulators (installed via Xamarin setup)
• Emulator
• Device (not really required but...)
Installing Xamarin.Android
A word on emulators
• Setup will install some basic emulators for you
• They’re great… for drinking a lot of coffee
Alternatives for the default emulators
• Possible options
• Genymotion
-Requires VirtualBox under the hood
• HAXM drivers
• Android Player from Xamarin
• Microsoft Android emulator
• Hyper-V
• Preferred option on Windows
DEMO
A quick look at the development setup
Xamarin.Android
fundamentals
File  New Project
File  New Project
Fundamental #1: Activities
• Apps are collections of activities
• A view == an activity (for now )
• Apps don’t have an “entry point”
• No single code line which is called by the OS
• Apps start when Android creates one of the classes of the app
• App then gets loaded into memory
Fundamental #1: Activities
• When opening an application, the OS creates the first Activity
• Activity is a specific class
• Defines UI and behaviour for a single task
• Corresponds to a single app screen
• App gets loaded in memory
OS
User launches app
Activity
Android loads app
In memory
Fundamental #1: Activities
• One activity needs to be the “entry point” for the app:
MainLauncher=True
Activity lifecycle
Activity lifecycle
• We can of course override these methods
• OnCreate:
• Create views, initialize variables, and do other prep work before the user sees the
Activity
• This method is called only once when the Activity is loaded into memory
• OnResume
• Perform any tasks that need to happen every time the Activity returns to the device
screen
• OnPause
• Perform any tasks that need to happen every time the Activity leaves the device screen
Activity lifecycle in effect
Fundamental #2: Views
• The layout of the app is contained in *.axml files
• AXML: Android designer file / Android XML
• First view of the app is named Main.axml
• Can be any name really
• AXML files live in the Resources/layout folder
The designer for Xamarin.Android views
The designer for Xamarin.Android views
View code
Connecting and accessing controls from code
• Linking a view with an activity is done using SetContentView
Connecting and accessing controls from code
• We can name controls using the ID property
• The Android designer maps the control to the Resource class and assigns it a
resource ID
• The code representation of a control is
linked to the visual representation
of the control in the
designer via the Id
property
Connecting and accessing controls from code
• Once we have created the controls, we can access them from code
• Field name is used for lookup
Fundamental #3: Application manifest
• An Android app contains a manifest file
• Contains a list of all resources, properties… that make up the application
• Also contains name, list of permissions… that the application has received
Images
Icons
*.axml
Others
Android Manifest file
DEMO
Creating our first Android application together!
Navigation and lists
Fundamental #4: ListViews and adapters
• Used very commonly in Android
• Common way to present lists of rows
• Each row is represented using a standard style or customized
• Consists out of
• ListView: visual part
• Adapter: feeds data to ListView
Fundamental #4: ListViews and adapters
Important classes
• ListView
• ListActivity
• BaseAdapter
• ArrayAdapter & ArrayAdapter<T>
ListActivity and the built-in ArrayAdapter<T>
[Activity(Label = "Coffees", MainLauncher = true, Icon = "@drawable/icon")]
public class CoffeeScreenActivity: ListActivity
{
string[] coffees;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
coffees= new string[] { "Coffee 1","Coffee 2", "Coffee 3"};
ListAdapter = new ArrayAdapter<String>(
this,
Android.Resource.Layout.SimpleListItem1,
coffees);
}
}
Implementing your own adapter
• In most cases, the ArrayAdapter won’t be enough
• We’ll need to create our own adapter
• Inherits from BaseAdapter
• Things we need to implement
• Count:
• To tell the control how many rows are in the data
• GetView:
• To return a View for each row, populated with data. This method has a parameter for the
ListView to pass in an existing, unused row for re-use
• GetItemId:
• Return a row identifier (typically the row number, although it can be any long value that you
like)
• this[int] indexer:
• To return the data associated with a particular row number
Handling row clicks
• To handle row clicks, we need to implement OnListItemClick
protected override void OnListItemClick(ListView l, View v, int position, long id)
{
var t = items[position];
//do something
}
DEMO
Adding a ListView and an adapter
Customizing the ListView with other row views
Customizing the ListView with other row views
Customizing the ListView with other row views
DEMO
Using the built-in row views
Creating your own row views
• Custom row layouts are AXML files in Resources/layout
• Are loaded by Id using a custom adapter
• View can contain any number of display classes with custom colors, fonts…
Creating your own
row view
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/CoffeeImageView"
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="5dp" />
<LinearLayout
android:id="@+id/TextFields"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dip">
<TextView
android:id="@+id/CoffeeNameText"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/PriceText"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
Using your custom row view
public override View GetView(int position, View convertView, ViewGroup parent)
{
//custom view
var item = items[position];
if (convertView == null)
{
convertView = context.LayoutInflater.Inflate (Resource.Layout.CoffeeRowView, null);
}
convertView.FindViewById<ImageView>
(Resource.Id.CoffeeImageView).SetImageResource(
imageRepository.ImageNameToResourceInt(item.ImageId.ToString()));
convertView.FindViewById<TextView>
(Resource.Id.CoffeeNameText).Text = item.CoffeeName;
convertView.FindViewById<TextView>
(Resource.Id.PriceText).Text = item.Price.ToString();
return convertView;
}
DEMO
Adding our own custom row view
Fundamental #5: Intents
• An Intent is an abstract concept for some sort of operation that
should be performed in Android
• Navigating to another activity
• Often, launching an external application (= built-in) with the intent of doing
something
• Make a phone call
• Launch a URI
• Map an address
• An intent often consist out of
• What the intent is
• The data needed for the intent
• Phone number to call
Intent of making a phone call
• ActionCall asks Android for an Activity to make a phone call
Intent of navigating to another screen
• StartActivity can be used to start another activity
• PutExtra() is used to pass data from one activity to the other
var intent = new Intent ();
intent.SetClass (this, typeof(CoffeeDetailActivity));
intent.PutExtra ("selectedCoffeeId", t.CoffeeId);
StartActivity (intent);
Receiving information from the intent
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Main);
var selectedCoffeeId = Intent.Extras.GetInt ("selectedCoffeeId", 0);
Coffee coffee = DataService.GetCoffeeById (selectedCoffeeId);
}
DEMO
Navigating from the List
to the Detail page
Optimizing
the application
Managing strings in strings.xml
• We can have Android store string values for us
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, Click Me!</string>
<string name="app_name">AndroidCoffeeStore</string>
<string name="coffeeNameLabel">Coffee name</string>
</resources>
<TextView
android:text="@string/coffeeNameLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/CoffeeNameLabel" />
Making the app multi-language
Application drawables
• We can add drawables: application icons
• Adding all resolutions makes sure the icons look good on all screens
• Filenames are the same
• Folder name identifies the resolution
Application drawables
• We can select an image in the project properties
• This now becomes the icon for the application within Android
DEMO
Adding resources
and drawables to the application
Deploying
to the store
Publishing your work
• Marketplace is most common option
• Often, more than one is used (Google Play, Amazon, GetJar…)
• Email or website is often for a more closed distribution
• Also require less work to prepare the application for distribution
• Google Play is best known store
• Allows users to discover, download, rate, and pay for applications by clicking a
single icon either on their device or on their computer
• Google Play also provides tools to assist in the analysis of sales and market
trends and to control which devices and users may download an application
Summary
• Xamarin.Android leverages your C# knowledge to build apps for
Android
• Concepts of Android mean a learning curve
Thanks!
Q&A
VISUG Partners
Building your first Android app
using Xamarin
Gill Cleeren
@gillcleeren

More Related Content

What's hot

Андрей Бойко - Azure Web App для PHP и Node.Js разработчиков
Андрей Бойко -  Azure Web App для PHP и Node.Js разработчиковАндрей Бойко -  Azure Web App для PHP и Node.Js разработчиков
Андрей Бойко - Azure Web App для PHP и Node.Js разработчиковHackraft
 
Infrastructure as Code on Azure: Show your Bicep!
Infrastructure as Code on Azure: Show your Bicep!Infrastructure as Code on Azure: Show your Bicep!
Infrastructure as Code on Azure: Show your Bicep!Marco Obinu
 
MAUI Blazor - One App that runs everywhere
MAUI Blazor - One App that runs everywhereMAUI Blazor - One App that runs everywhere
MAUI Blazor - One App that runs everywhereJose Javier Columbie
 
Azure cloud for the web frontend developers
Azure cloud for the web frontend developersAzure cloud for the web frontend developers
Azure cloud for the web frontend developersMaxim Salnikov
 
Go Serverless with Java and Azure Functions
Go Serverless with Java and Azure FunctionsGo Serverless with Java and Azure Functions
Go Serverless with Java and Azure FunctionsCodeOps Technologies LLP
 
Azure serverless architectures
Azure serverless architecturesAzure serverless architectures
Azure serverless architecturesBenoit Le Pichon
 
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio StruyfO365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio StruyfNCCOMMS
 
Build 2017 - Whats new for Xamarin Devs
Build 2017 - Whats new for Xamarin DevsBuild 2017 - Whats new for Xamarin Devs
Build 2017 - Whats new for Xamarin DevsMike James
 
Building a Google Cloud Firestore API with dotnet core
Building a Google Cloud Firestore API with dotnet coreBuilding a Google Cloud Firestore API with dotnet core
Building a Google Cloud Firestore API with dotnet coreMike Melusky
 
MICROSOFT BLAZOR - NEXT GENERATION WEB UI OR SILVERLIGHT ALL OVER AGAIN?
MICROSOFT BLAZOR - NEXT GENERATION WEB UI OR SILVERLIGHT ALL OVER AGAIN?MICROSOFT BLAZOR - NEXT GENERATION WEB UI OR SILVERLIGHT ALL OVER AGAIN?
MICROSOFT BLAZOR - NEXT GENERATION WEB UI OR SILVERLIGHT ALL OVER AGAIN?Clint Edmonson
 
O365Con18 - Working with PowerShell, VS Code and GitHub - Thomas Vochten
O365Con18 - Working with PowerShell, VS Code and GitHub - Thomas VochtenO365Con18 - Working with PowerShell, VS Code and GitHub - Thomas Vochten
O365Con18 - Working with PowerShell, VS Code and GitHub - Thomas VochtenNCCOMMS
 
BizTalk Server Extensibility
BizTalk Server ExtensibilityBizTalk Server Extensibility
BizTalk Server ExtensibilityBizTalk360
 
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)Chris O'Brien
 
SPUnite17 Timer Jobs Event Handlers
SPUnite17 Timer Jobs Event HandlersSPUnite17 Timer Jobs Event Handlers
SPUnite17 Timer Jobs Event HandlersNCCOMMS
 
DDD, CQRS & ES lessons learned (Gitte Vermeiren)
DDD, CQRS & ES lessons learned (Gitte Vermeiren)DDD, CQRS & ES lessons learned (Gitte Vermeiren)
DDD, CQRS & ES lessons learned (Gitte Vermeiren)Visug
 
Container Orchestration for .NET Developers
Container Orchestration for .NET DevelopersContainer Orchestration for .NET Developers
Container Orchestration for .NET DevelopersMike Melusky
 
Cross platform mobile development with xamarin and office 365
Cross platform mobile development with xamarin and office 365Cross platform mobile development with xamarin and office 365
Cross platform mobile development with xamarin and office 365SoHo Dragon
 
ECS19 - Daniel Neumann - AZURE FUNCTIONS 2.0 - RUNNING SERVERLESS EVERYWHERE
ECS19 - Daniel Neumann - AZURE FUNCTIONS 2.0 - RUNNING SERVERLESS EVERYWHEREECS19 - Daniel Neumann - AZURE FUNCTIONS 2.0 - RUNNING SERVERLESS EVERYWHERE
ECS19 - Daniel Neumann - AZURE FUNCTIONS 2.0 - RUNNING SERVERLESS EVERYWHEREEuropean Collaboration Summit
 
Effective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and DapperEffective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and DapperMike Melusky
 
Introduction Asp.Net MVC5 |MVC5 Tutorial for Beginners & Advanced | Dot Net T...
Introduction Asp.Net MVC5 |MVC5 Tutorial for Beginners & Advanced | Dot Net T...Introduction Asp.Net MVC5 |MVC5 Tutorial for Beginners & Advanced | Dot Net T...
Introduction Asp.Net MVC5 |MVC5 Tutorial for Beginners & Advanced | Dot Net T...Dot Net Tricks
 

What's hot (20)

Андрей Бойко - Azure Web App для PHP и Node.Js разработчиков
Андрей Бойко -  Azure Web App для PHP и Node.Js разработчиковАндрей Бойко -  Azure Web App для PHP и Node.Js разработчиков
Андрей Бойко - Azure Web App для PHP и Node.Js разработчиков
 
Infrastructure as Code on Azure: Show your Bicep!
Infrastructure as Code on Azure: Show your Bicep!Infrastructure as Code on Azure: Show your Bicep!
Infrastructure as Code on Azure: Show your Bicep!
 
MAUI Blazor - One App that runs everywhere
MAUI Blazor - One App that runs everywhereMAUI Blazor - One App that runs everywhere
MAUI Blazor - One App that runs everywhere
 
Azure cloud for the web frontend developers
Azure cloud for the web frontend developersAzure cloud for the web frontend developers
Azure cloud for the web frontend developers
 
Go Serverless with Java and Azure Functions
Go Serverless with Java and Azure FunctionsGo Serverless with Java and Azure Functions
Go Serverless with Java and Azure Functions
 
Azure serverless architectures
Azure serverless architecturesAzure serverless architectures
Azure serverless architectures
 
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio StruyfO365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
 
Build 2017 - Whats new for Xamarin Devs
Build 2017 - Whats new for Xamarin DevsBuild 2017 - Whats new for Xamarin Devs
Build 2017 - Whats new for Xamarin Devs
 
Building a Google Cloud Firestore API with dotnet core
Building a Google Cloud Firestore API with dotnet coreBuilding a Google Cloud Firestore API with dotnet core
Building a Google Cloud Firestore API with dotnet core
 
MICROSOFT BLAZOR - NEXT GENERATION WEB UI OR SILVERLIGHT ALL OVER AGAIN?
MICROSOFT BLAZOR - NEXT GENERATION WEB UI OR SILVERLIGHT ALL OVER AGAIN?MICROSOFT BLAZOR - NEXT GENERATION WEB UI OR SILVERLIGHT ALL OVER AGAIN?
MICROSOFT BLAZOR - NEXT GENERATION WEB UI OR SILVERLIGHT ALL OVER AGAIN?
 
O365Con18 - Working with PowerShell, VS Code and GitHub - Thomas Vochten
O365Con18 - Working with PowerShell, VS Code and GitHub - Thomas VochtenO365Con18 - Working with PowerShell, VS Code and GitHub - Thomas Vochten
O365Con18 - Working with PowerShell, VS Code and GitHub - Thomas Vochten
 
BizTalk Server Extensibility
BizTalk Server ExtensibilityBizTalk Server Extensibility
BizTalk Server Extensibility
 
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
 
SPUnite17 Timer Jobs Event Handlers
SPUnite17 Timer Jobs Event HandlersSPUnite17 Timer Jobs Event Handlers
SPUnite17 Timer Jobs Event Handlers
 
DDD, CQRS & ES lessons learned (Gitte Vermeiren)
DDD, CQRS & ES lessons learned (Gitte Vermeiren)DDD, CQRS & ES lessons learned (Gitte Vermeiren)
DDD, CQRS & ES lessons learned (Gitte Vermeiren)
 
Container Orchestration for .NET Developers
Container Orchestration for .NET DevelopersContainer Orchestration for .NET Developers
Container Orchestration for .NET Developers
 
Cross platform mobile development with xamarin and office 365
Cross platform mobile development with xamarin and office 365Cross platform mobile development with xamarin and office 365
Cross platform mobile development with xamarin and office 365
 
ECS19 - Daniel Neumann - AZURE FUNCTIONS 2.0 - RUNNING SERVERLESS EVERYWHERE
ECS19 - Daniel Neumann - AZURE FUNCTIONS 2.0 - RUNNING SERVERLESS EVERYWHEREECS19 - Daniel Neumann - AZURE FUNCTIONS 2.0 - RUNNING SERVERLESS EVERYWHERE
ECS19 - Daniel Neumann - AZURE FUNCTIONS 2.0 - RUNNING SERVERLESS EVERYWHERE
 
Effective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and DapperEffective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and Dapper
 
Introduction Asp.Net MVC5 |MVC5 Tutorial for Beginners & Advanced | Dot Net T...
Introduction Asp.Net MVC5 |MVC5 Tutorial for Beginners & Advanced | Dot Net T...Introduction Asp.Net MVC5 |MVC5 Tutorial for Beginners & Advanced | Dot Net T...
Introduction Asp.Net MVC5 |MVC5 Tutorial for Beginners & Advanced | Dot Net T...
 

Similar to Building your first android app using xamarin (Gill Cleeren)

Building your first android app using Xamarin
Building your first android app using XamarinBuilding your first android app using Xamarin
Building your first android app using XamarinGill Cleeren
 
Native script overview
Native script overviewNative script overview
Native script overviewBaskar rao Dsn
 
Android application development for TresmaxAsia
Android application development for TresmaxAsiaAndroid application development for TresmaxAsia
Android application development for TresmaxAsiaMichael Angelo Rivera
 
Native Script Overview
Native Script OverviewNative Script Overview
Native Script OverviewBaskar rao Dsn
 
Native script overview
Native script overviewNative script overview
Native script overviewBaskar rao Dsn
 
Androidoscon20080721 1216843094441821-9
Androidoscon20080721 1216843094441821-9Androidoscon20080721 1216843094441821-9
Androidoscon20080721 1216843094441821-9Gustavo Fuentes Zurita
 
Androidoscon20080721 1216843094441821-9
Androidoscon20080721 1216843094441821-9Androidoscon20080721 1216843094441821-9
Androidoscon20080721 1216843094441821-9Gustavo Fuentes Zurita
 
Native Script Atlanta Code Camp
Native Script Atlanta Code CampNative Script Atlanta Code Camp
Native Script Atlanta Code CampBaskar rao Dsn
 
Froyo to kit kat two years developing & maintaining deliradio
Froyo to kit kat   two years developing & maintaining deliradioFroyo to kit kat   two years developing & maintaining deliradio
Froyo to kit kat two years developing & maintaining deliradioDroidcon Berlin
 
[2015/2016] Apache Cordova
[2015/2016] Apache Cordova[2015/2016] Apache Cordova
[2015/2016] Apache CordovaIvano Malavolta
 
Lec005 android start_program
Lec005 android start_programLec005 android start_program
Lec005 android start_programEyad Almasri
 
Android Workshop
Android WorkshopAndroid Workshop
Android WorkshopJunda Ong
 
Building your first iOS app using Xamarin
Building your first iOS app using XamarinBuilding your first iOS app using Xamarin
Building your first iOS app using XamarinGill Cleeren
 
Develop business apps cross-platform development using visual studio with x...
Develop business apps   cross-platform development using visual studio with x...Develop business apps   cross-platform development using visual studio with x...
Develop business apps cross-platform development using visual studio with x...Alexander Meijers
 
Matteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break editionMatteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break editionDuckMa
 

Similar to Building your first android app using xamarin (Gill Cleeren) (20)

Building your first android app using Xamarin
Building your first android app using XamarinBuilding your first android app using Xamarin
Building your first android app using Xamarin
 
Android - Anroid Pproject
Android - Anroid PprojectAndroid - Anroid Pproject
Android - Anroid Pproject
 
Native script overview
Native script overviewNative script overview
Native script overview
 
Android application development for TresmaxAsia
Android application development for TresmaxAsiaAndroid application development for TresmaxAsia
Android application development for TresmaxAsia
 
Native Script Overview
Native Script OverviewNative Script Overview
Native Script Overview
 
Dfc 2018 NativeScript
Dfc 2018 NativeScriptDfc 2018 NativeScript
Dfc 2018 NativeScript
 
Native script overview
Native script overviewNative script overview
Native script overview
 
Androidoscon20080721 1216843094441821-9
Androidoscon20080721 1216843094441821-9Androidoscon20080721 1216843094441821-9
Androidoscon20080721 1216843094441821-9
 
Androidoscon20080721 1216843094441821-9
Androidoscon20080721 1216843094441821-9Androidoscon20080721 1216843094441821-9
Androidoscon20080721 1216843094441821-9
 
Native Script Atlanta Code Camp
Native Script Atlanta Code CampNative Script Atlanta Code Camp
Native Script Atlanta Code Camp
 
Froyo to kit kat two years developing & maintaining deliradio
Froyo to kit kat   two years developing & maintaining deliradioFroyo to kit kat   two years developing & maintaining deliradio
Froyo to kit kat two years developing & maintaining deliradio
 
[2015/2016] Apache Cordova
[2015/2016] Apache Cordova[2015/2016] Apache Cordova
[2015/2016] Apache Cordova
 
Lec005 android start_program
Lec005 android start_programLec005 android start_program
Lec005 android start_program
 
Presentation1
Presentation1Presentation1
Presentation1
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 
Building your first iOS app using Xamarin
Building your first iOS app using XamarinBuilding your first iOS app using Xamarin
Building your first iOS app using Xamarin
 
Develop business apps cross-platform development using visual studio with x...
Develop business apps   cross-platform development using visual studio with x...Develop business apps   cross-platform development using visual studio with x...
Develop business apps cross-platform development using visual studio with x...
 
Matteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break editionMatteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break edition
 
Apache Cordova 4.x
Apache Cordova 4.xApache Cordova 4.x
Apache Cordova 4.x
 
Android class provider in mumbai
Android class provider in mumbaiAndroid class provider in mumbai
Android class provider in mumbai
 

More from Visug

Gdbc keynote-visug
Gdbc keynote-visugGdbc keynote-visug
Gdbc keynote-visugVisug
 
Making enabling apps for disabled people
Making enabling apps for disabled peopleMaking enabling apps for disabled people
Making enabling apps for disabled peopleVisug
 
How many iot technologies do you need to turn on a lightbulb (Kurt Claeys)
How many iot technologies do you need to turn on a lightbulb (Kurt Claeys)How many iot technologies do you need to turn on a lightbulb (Kurt Claeys)
How many iot technologies do you need to turn on a lightbulb (Kurt Claeys)Visug
 
Sherlock Homepage (Maarten Balliauw)
Sherlock Homepage (Maarten Balliauw)Sherlock Homepage (Maarten Balliauw)
Sherlock Homepage (Maarten Balliauw)Visug
 
Service Fabric Overview (Yves Goeleven)
Service Fabric Overview (Yves Goeleven)Service Fabric Overview (Yves Goeleven)
Service Fabric Overview (Yves Goeleven)Visug
 
DevOps with Visual studio Release Management (Pieter Gheysens)
DevOps with Visual studio Release Management (Pieter Gheysens)DevOps with Visual studio Release Management (Pieter Gheysens)
DevOps with Visual studio Release Management (Pieter Gheysens)Visug
 
Exploring XLabs
Exploring XLabsExploring XLabs
Exploring XLabsVisug
 
Hello windows 10: An overview of the new features for developers in WIndows 10
Hello windows 10: An overview of the new features for developers in WIndows 10Hello windows 10: An overview of the new features for developers in WIndows 10
Hello windows 10: An overview of the new features for developers in WIndows 10Visug
 
So you write JavaScript? Keep the crap out of there then!
So you write JavaScript? Keep the crap out of there then!So you write JavaScript? Keep the crap out of there then!
So you write JavaScript? Keep the crap out of there then!Visug
 
Visug: Say Hello to my little friend: a session on Kinect
Visug: Say Hello to my little friend: a session on KinectVisug: Say Hello to my little friend: a session on Kinect
Visug: Say Hello to my little friend: a session on KinectVisug
 

More from Visug (10)

Gdbc keynote-visug
Gdbc keynote-visugGdbc keynote-visug
Gdbc keynote-visug
 
Making enabling apps for disabled people
Making enabling apps for disabled peopleMaking enabling apps for disabled people
Making enabling apps for disabled people
 
How many iot technologies do you need to turn on a lightbulb (Kurt Claeys)
How many iot technologies do you need to turn on a lightbulb (Kurt Claeys)How many iot technologies do you need to turn on a lightbulb (Kurt Claeys)
How many iot technologies do you need to turn on a lightbulb (Kurt Claeys)
 
Sherlock Homepage (Maarten Balliauw)
Sherlock Homepage (Maarten Balliauw)Sherlock Homepage (Maarten Balliauw)
Sherlock Homepage (Maarten Balliauw)
 
Service Fabric Overview (Yves Goeleven)
Service Fabric Overview (Yves Goeleven)Service Fabric Overview (Yves Goeleven)
Service Fabric Overview (Yves Goeleven)
 
DevOps with Visual studio Release Management (Pieter Gheysens)
DevOps with Visual studio Release Management (Pieter Gheysens)DevOps with Visual studio Release Management (Pieter Gheysens)
DevOps with Visual studio Release Management (Pieter Gheysens)
 
Exploring XLabs
Exploring XLabsExploring XLabs
Exploring XLabs
 
Hello windows 10: An overview of the new features for developers in WIndows 10
Hello windows 10: An overview of the new features for developers in WIndows 10Hello windows 10: An overview of the new features for developers in WIndows 10
Hello windows 10: An overview of the new features for developers in WIndows 10
 
So you write JavaScript? Keep the crap out of there then!
So you write JavaScript? Keep the crap out of there then!So you write JavaScript? Keep the crap out of there then!
So you write JavaScript? Keep the crap out of there then!
 
Visug: Say Hello to my little friend: a session on Kinect
Visug: Say Hello to my little friend: a session on KinectVisug: Say Hello to my little friend: a session on Kinect
Visug: Say Hello to my little friend: a session on Kinect
 

Recently uploaded

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Recently uploaded (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

Building your first android app using xamarin (Gill Cleeren)

  • 1. Building your first Android app using Xamarin Gill Cleeren @gillcleeren
  • 2. Hi, I’m Gill! Gill Cleeren MVP and Regional Director .NET Practice Manager @ Ordina Trainer & speaker @gillcleeren gill@snowball.be
  • 3. I’m a Pluralsight author! • Courses on Xamarin, WPF, social and HTML5 • http://gicl.me/mypscourses
  • 4. Agenda • Overview of Xamarin and Xamarin.Android • Xamarin.Android fundamentals • Creating a detail screen • Lists and navigation • Navigating from master to detail • Optimizing the application • Preparing for store deployment
  • 5. Targets of this talk • Understanding the fundamentals of Android app development with Xamarin • See how a fully working app can be built
  • 6. The demo scenario • Android Coffee Store Manager • List of coffees • Navigation to details page
  • 7. DEMO Looking at the finished application
  • 8. Overview of Xamarin and Xamarin.Android
  • 9. Hello Xamarin • Xamarin enables developers to reach all major mobile platforms! • Native User Interface • Native Performance • Shared Code Across Platforms • C# & .NET Framework • Toolset on top of Visual Studio • Enables VS to create native iOS and Android apps • Commercial product
  • 10. Write Everything in C# iOS, Android, Windows, Windows Phone, Mac Billions of Devices covered!
  • 11. The Xamarin platform Xamarin Xamarin.Android Xamarin.iOS Xamarin Forms
  • 12. Xamarin.Android exposes many extra device types
  • 13. Xamarin.Android Anything you can do in Java/Android can be done in C# and Visual Studio (or Xamarin Studio) with Xamarin!
  • 14. How Xamarin works on Android • Mono VM + Java VM execute side-by-side (supports both Dalvik and ART) • Mono VM JITs IL into native code and executes most of your code • Can utilize native libraries directly as well as .NET BCL
  • 15. A word on code-sharing • Xamarin brings development time through the use of code-sharing • Possible (currently!) using • Shared projects: • allows organizing the shared code • #if directives for platform specific code • PCL • “include” the platforms we want to support • Abstract to interfaces where platforms have specific implementations
  • 16. Target architecture for a Xamarin app
  • 18. What you need for Xamarin.Android development • Xamarin license (Xamarin.Android) • PC or Mac • Visual Studio or Xamarin Studio • Android SDK and Emulators (installed via Xamarin setup) • Emulator • Device (not really required but...)
  • 20. A word on emulators • Setup will install some basic emulators for you • They’re great… for drinking a lot of coffee
  • 21. Alternatives for the default emulators • Possible options • Genymotion -Requires VirtualBox under the hood • HAXM drivers • Android Player from Xamarin • Microsoft Android emulator • Hyper-V • Preferred option on Windows
  • 22. DEMO A quick look at the development setup
  • 24. File  New Project
  • 25. File  New Project
  • 26. Fundamental #1: Activities • Apps are collections of activities • A view == an activity (for now ) • Apps don’t have an “entry point” • No single code line which is called by the OS • Apps start when Android creates one of the classes of the app • App then gets loaded into memory
  • 27. Fundamental #1: Activities • When opening an application, the OS creates the first Activity • Activity is a specific class • Defines UI and behaviour for a single task • Corresponds to a single app screen • App gets loaded in memory OS User launches app Activity Android loads app In memory
  • 28. Fundamental #1: Activities • One activity needs to be the “entry point” for the app: MainLauncher=True
  • 30. Activity lifecycle • We can of course override these methods • OnCreate: • Create views, initialize variables, and do other prep work before the user sees the Activity • This method is called only once when the Activity is loaded into memory • OnResume • Perform any tasks that need to happen every time the Activity returns to the device screen • OnPause • Perform any tasks that need to happen every time the Activity leaves the device screen
  • 32. Fundamental #2: Views • The layout of the app is contained in *.axml files • AXML: Android designer file / Android XML • First view of the app is named Main.axml • Can be any name really • AXML files live in the Resources/layout folder
  • 33. The designer for Xamarin.Android views
  • 34. The designer for Xamarin.Android views
  • 36. Connecting and accessing controls from code • Linking a view with an activity is done using SetContentView
  • 37. Connecting and accessing controls from code • We can name controls using the ID property • The Android designer maps the control to the Resource class and assigns it a resource ID • The code representation of a control is linked to the visual representation of the control in the designer via the Id property
  • 38. Connecting and accessing controls from code • Once we have created the controls, we can access them from code • Field name is used for lookup
  • 39. Fundamental #3: Application manifest • An Android app contains a manifest file • Contains a list of all resources, properties… that make up the application • Also contains name, list of permissions… that the application has received Images Icons *.axml Others Android Manifest file
  • 40.
  • 41. DEMO Creating our first Android application together!
  • 43. Fundamental #4: ListViews and adapters • Used very commonly in Android • Common way to present lists of rows • Each row is represented using a standard style or customized • Consists out of • ListView: visual part • Adapter: feeds data to ListView
  • 45. Important classes • ListView • ListActivity • BaseAdapter • ArrayAdapter & ArrayAdapter<T>
  • 46. ListActivity and the built-in ArrayAdapter<T> [Activity(Label = "Coffees", MainLauncher = true, Icon = "@drawable/icon")] public class CoffeeScreenActivity: ListActivity { string[] coffees; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); coffees= new string[] { "Coffee 1","Coffee 2", "Coffee 3"}; ListAdapter = new ArrayAdapter<String>( this, Android.Resource.Layout.SimpleListItem1, coffees); } }
  • 47. Implementing your own adapter • In most cases, the ArrayAdapter won’t be enough • We’ll need to create our own adapter • Inherits from BaseAdapter • Things we need to implement • Count: • To tell the control how many rows are in the data • GetView: • To return a View for each row, populated with data. This method has a parameter for the ListView to pass in an existing, unused row for re-use • GetItemId: • Return a row identifier (typically the row number, although it can be any long value that you like) • this[int] indexer: • To return the data associated with a particular row number
  • 48. Handling row clicks • To handle row clicks, we need to implement OnListItemClick protected override void OnListItemClick(ListView l, View v, int position, long id) { var t = items[position]; //do something }
  • 49. DEMO Adding a ListView and an adapter
  • 50. Customizing the ListView with other row views
  • 51. Customizing the ListView with other row views
  • 52. Customizing the ListView with other row views
  • 54. Creating your own row views • Custom row layouts are AXML files in Resources/layout • Are loaded by Id using a custom adapter • View can contain any number of display classes with custom colors, fonts…
  • 55. Creating your own row view <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="8dp" android:orientation="horizontal"> <ImageView android:id="@+id/CoffeeImageView" android:layout_width="50dp" android:layout_height="50dp" android:padding="5dp" /> <LinearLayout android:id="@+id/TextFields" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingLeft="10dip"> <TextView android:id="@+id/CoffeeNameText" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/PriceText" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> </LinearLayout>
  • 56. Using your custom row view public override View GetView(int position, View convertView, ViewGroup parent) { //custom view var item = items[position]; if (convertView == null) { convertView = context.LayoutInflater.Inflate (Resource.Layout.CoffeeRowView, null); } convertView.FindViewById<ImageView> (Resource.Id.CoffeeImageView).SetImageResource( imageRepository.ImageNameToResourceInt(item.ImageId.ToString())); convertView.FindViewById<TextView> (Resource.Id.CoffeeNameText).Text = item.CoffeeName; convertView.FindViewById<TextView> (Resource.Id.PriceText).Text = item.Price.ToString(); return convertView; }
  • 57. DEMO Adding our own custom row view
  • 58. Fundamental #5: Intents • An Intent is an abstract concept for some sort of operation that should be performed in Android • Navigating to another activity • Often, launching an external application (= built-in) with the intent of doing something • Make a phone call • Launch a URI • Map an address • An intent often consist out of • What the intent is • The data needed for the intent • Phone number to call
  • 59. Intent of making a phone call • ActionCall asks Android for an Activity to make a phone call
  • 60. Intent of navigating to another screen • StartActivity can be used to start another activity • PutExtra() is used to pass data from one activity to the other var intent = new Intent (); intent.SetClass (this, typeof(CoffeeDetailActivity)); intent.PutExtra ("selectedCoffeeId", t.CoffeeId); StartActivity (intent);
  • 61. Receiving information from the intent protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Main); var selectedCoffeeId = Intent.Extras.GetInt ("selectedCoffeeId", 0); Coffee coffee = DataService.GetCoffeeById (selectedCoffeeId); }
  • 62. DEMO Navigating from the List to the Detail page
  • 64. Managing strings in strings.xml • We can have Android store string values for us <?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello">Hello World, Click Me!</string> <string name="app_name">AndroidCoffeeStore</string> <string name="coffeeNameLabel">Coffee name</string> </resources> <TextView android:text="@string/coffeeNameLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/CoffeeNameLabel" />
  • 65. Making the app multi-language
  • 66. Application drawables • We can add drawables: application icons • Adding all resolutions makes sure the icons look good on all screens • Filenames are the same • Folder name identifies the resolution
  • 67. Application drawables • We can select an image in the project properties • This now becomes the icon for the application within Android
  • 70. Publishing your work • Marketplace is most common option • Often, more than one is used (Google Play, Amazon, GetJar…) • Email or website is often for a more closed distribution • Also require less work to prepare the application for distribution • Google Play is best known store • Allows users to discover, download, rate, and pay for applications by clicking a single icon either on their device or on their computer • Google Play also provides tools to assist in the analysis of sales and market trends and to control which devices and users may download an application
  • 71. Summary • Xamarin.Android leverages your C# knowledge to build apps for Android • Concepts of Android mean a learning curve
  • 73. Q&A
  • 75. Building your first Android app using Xamarin Gill Cleeren @gillcleeren

Editor's Notes

  1. Demo 7
  2. -Mac + PC demo omgeving
  3. Demo 2 Detail View
  4. Demo 3
  5. Demo 3 second time
  6. Demo 4
  7. Demo 5
  8. Demo 6
  9. Demo 7