SlideShare ist ein Scribd-Unternehmen logo
1 von 60
2013.11.09
#DevFest Lombardia
#DevFestLomb
@ Università degli Studi Milano Bicocca
Who I Am
+MatteoGazzurelli

CEO / Android Developer
DUCKMA srl - Brescia
@gazzumatteo
2
#devfestlomb

Introduction to Android
Android, the unknown...
3
Android, questo sconosciuto...

• 

Mobile Operating System by Android Inc.

• 

Bought by Google in 2005

• 

Unveiled in 2007

3
Why develop for Android?

• 

Is adaptable and functional

• 

Very good OS

• 

Good Business!

5
Google’s Role

• 

Development & Support

• 

Google Play

• 

Nexus

Developers

6
Android 101
In theory…. and in practice.

7
Java Based
Java VM

Java

Hello World

Dalvik VM

8
What do I need to know to be a programmer?

• 

OOP (Object Oriented Programming)

• 

Encapsulation, Inheritance,
Polymorphism

• 

Interfaces

• 

Listeners

• 

Packages structure
9
Inside the Droid
Architecture & Theory

10
Android Architecture
Application
Home, Contacts, Telephone, Browser, …

Application Framework
Managers for Activity, Window, Package, …

Libraries
SQLite, OpenGL, SSL, …

Runtime
Dalvik VM, Core libs

Kernel Linux
Driver for Display, Camera, Flash, Wifi, Audio, …
11
Four pillars of Android

• 

Activities

• 

Services

• 

Broadcast Receivers

• 

Content Providers

12
Activities

• 

Activity is the main component of Android, represent
a single screen whit a user interface

• 

Is like a form in traditional languages such as Visual
Basic or like a single HTML page

13
Activity Lifecycle

14
Introduction to Intents

• 
• 
• 

Intents are used as a message-passing mechanism
that works both within your application, and between
applications.
Interacts with every components in Android
Used for:

• 
• 
• 

Declare your intention that an Activity or Service be started to perform an
action, usually with a piece of data ( startActivity(Intent); )
Broadcast that an event (or action) has occurred
Explicity start a particular Service or Activity

15
Services

• 
• 
• 
• 

Application components that can perform longrunning operations in the background
Doesn’t provide a user interface
Service is not a separate process or thread
Service is a simple class, you must implement
separate threads by yourself

16
Service Lifecycle

17
Broadcast Receiver

• 

A Broadcast receiver is a component that does nothing
but receive and react to broadcast announcements

• 

Broadcast Intent

• 

Your app can:

• 
• 
• 

Receive and react to system services (ex. Battery low)
Receive and react to other apps broadcast announcements
Initiate broadcasts to other apps

18
Content Provider

• 
• 
• 
• 
• 
• 

Content Providers manage access to a structured set of
data
Are the standard interface that connects data in one
process with code running in another process
Any application with appropriate permission, can read and
write the data
Files, SQL Database
Expose a public URI that uniquely identifies its data set
“content://…”
19
Content Provider

20
Hands On
Down and dirty!

21
Craftsman tools

• 

IDE

• 

Tools:

• 
• 
• 
• 
• 
• 

Eclipse
Android Studio

ADT (Android Developer Tools)
Android SDK Tools
Android Platform Tools
AVD (Android Virtual Device) / Emulator

22
Eclipse / Android Studio

23
Android SDK Manager (via ADT)

24
Android Virtual Device Manager (AVD)

25
LogCat

26
Debug

27
Let’s start a new project
Gentlemen start your engines!

28
File -> New Project

29
Tutorial

30
Project structure

31
Src

• 

Java Classes

• 

Organized in Packages

• 
• 
• 
• 

Activity
Fragment
Adapter
Models

32
Activity
Sample Code
package com.example;

JAVA

import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
protected void onPause(Bundle savedInstanceState) {
super.onPause();
}
}
33
Fragments

• 

Since Android 3.0

• 

Represent a portion of the UI in an activity

• 

Can combine multiple fragment in a single activity

• 

Have their lifecycle

• 

Live in a ViewGroup
34
Assets e Lib

• 

Assets

• 

Libs

• 
• 
• 

Not optimized and compiled resources

External libraries
Java o C

35
Resources

• 
• 
• 

Any other information that are not code
Stored in config files external to code (but inside the final
apk package)
Contain

• 
• 
• 
• 

Drawable
Layouts
Xml
Values

36
Classe R.java

• 

Bridge between activities and resources

• 

In gen/

• 

Dynamically generated (by Android’s Eclipse plugin) and
contains numeric constant referred to every resources of
the project

• 

Contains only public fields (“public static final”)
37
Resource Example
String.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

XML

<string name="app_name">Test</string>
<string name="action_settings" >Settings</string>
<string name="hello_world" >Hello world!</string>
</resources>

38
Layout

• 

XML Files

• 

Defines the visual structure for a user interface

• 

Target many resolutions

39
Layout Example
Activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

XML

<TextView
android:layout_width="wrap_content”
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</RelativeLayout>
40
Widget

• 

Visual Components of Android

• 
• 
• 
• 
• 
• 

Button
TextView
EditText
WebView
ImageView
…

41
Widget Example
Button
JAVA

Button myButton = new Button(this);
myButton.setText(R.string.button_back);
myButton.setLayoutParams(new LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
));

XML

<Button
android:id="@+id/button1”
android:layout_width="wrap_content”
android:layout_height="wrap_content”
android:layout_alignLeft="@+id/textView1”
android:layout_below="@+id/textView1”
android:layout_marginLeft="41dp”
android:text="Button” />

42
Eclipse UI Builder

43
Views

• 

Base component for UI (Widget)

• 

Layout

• 

View Groups

• 
• 

Visual structure of the UI

Invisible Container that contains other View or ViewGroup

44
Manifest

• 

Contains the essential information about the application

• 

Other elements to declare

• 
• 
• 
• 
• 

Version
Name
Icon
Permission
Features

• 
• 
• 
• 
• 
• 

Activity
Services
Provider
Receiver
uses-sdk
uses-permission

45
Design Pattern

• 

Model – View – Controller

• 

Model – View – Presenter

• 

In the official Android documentations doesn’t exists any
referral to these patterns

• 
• 

Activity -> Controller

Activity -> View

46
Fragmentation
‘minSdkVersion=“14”’

47
Android Family Tree

1.5 Cupcake

1.6 Donut

2.0 Eclair

2.2 Froyo

2.3 Gingerbread

4.4 KitKat

3.0 Honeycomb
4.0 Ice Cream Sandwich

4.1 Jelly Bean
48
November Fragmentation Status

49
How many Display!

Screen Types

vs

Screen Sizes
50
Suggestions (No Panic!)

• 

Choose the right target of your application

• 
• 
• 
• 

Learn how to use correctly the res.
Support library
Test on at least two devices
Fragmentation can be an advantage

• 

minSdkVersion=“14”

51
Publish
Make public your creations!

52
Markets

• 

Google

• 

Samsung

• 

Amazon

• 

Any other market (your)

53
Google Play Store

54
Google Play Store - Publish

55
Google Play Store - Stats

56
Introduction to Android – The End
+MatteoGazzurelli
That’s me!

#devfestlomb
matteo@duckma.com

Thank You & Have Fun!
57
Questions?

58
Links

• 
• 
• 
• 

Android Developer
http://developer.android.com
Android Design Guidelines
http://developer.android.com/design/
Play Store Publish
http://play.google.com/apps/publish/
Duckma
http://duckma.com
59
Introduction to Android – The End
+MatteoGazzurelli
That’s me!

#devfestlomb
matteo@duckma.com

Thank You & Have Fun!
60

Weitere ähnliche Inhalte

Was ist angesagt?

Android application development
Android application developmentAndroid application development
Android application development
slidesuren
 
Android application development workshop day1
Android application development workshop   day1Android application development workshop   day1
Android application development workshop day1
Borhan Otour
 
Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginners
Boom Shukla
 

Was ist angesagt? (20)

Android application development
Android application developmentAndroid application development
Android application development
 
Android Development
Android DevelopmentAndroid Development
Android Development
 
Android application development workshop day1
Android application development workshop   day1Android application development workshop   day1
Android application development workshop day1
 
Rajnish singh(presentation on oracle )
Rajnish singh(presentation on  oracle )Rajnish singh(presentation on  oracle )
Rajnish singh(presentation on oracle )
 
Developing for Android-Types of Android Application
Developing for Android-Types of Android ApplicationDeveloping for Android-Types of Android Application
Developing for Android-Types of Android Application
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
Android Application Fundamentals
Android Application FundamentalsAndroid Application Fundamentals
Android Application Fundamentals
 
Plantilla oracle
Plantilla oraclePlantilla oracle
Plantilla oracle
 
Post-mortem Debugging of Windows Applications
Post-mortem Debugging of  Windows ApplicationsPost-mortem Debugging of  Windows Applications
Post-mortem Debugging of Windows Applications
 
Inside the Android application framework - Google I/O 2009
Inside the Android application framework - Google I/O 2009Inside the Android application framework - Google I/O 2009
Inside the Android application framework - Google I/O 2009
 
Arduino - Android Workshop Presentation
Arduino - Android Workshop PresentationArduino - Android Workshop Presentation
Arduino - Android Workshop Presentation
 
Single-Window Integrated Development Environment
Single-Window Integrated Development EnvironmentSingle-Window Integrated Development Environment
Single-Window Integrated Development Environment
 
Android : How Do I Code Thee?
Android : How Do I Code Thee?Android : How Do I Code Thee?
Android : How Do I Code Thee?
 
Build and automate your machine learning application with docker and jenkins
Build and automate your machine learning application with docker and jenkinsBuild and automate your machine learning application with docker and jenkins
Build and automate your machine learning application with docker and jenkins
 
Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginners
 
Ow
OwOw
Ow
 
Application Development - Overview on Android OS
Application Development - Overview on Android OSApplication Development - Overview on Android OS
Application Development - Overview on Android OS
 
Introduction to Docker Workshop @ Gurukul Kangri
Introduction to Docker Workshop @ Gurukul KangriIntroduction to Docker Workshop @ Gurukul Kangri
Introduction to Docker Workshop @ Gurukul Kangri
 
Case Study: Cool Clock - An Intro to Android Development
Case Study: Cool Clock - An Intro to Android DevelopmentCase Study: Cool Clock - An Intro to Android Development
Case Study: Cool Clock - An Intro to Android Development
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 

Ähnlich wie Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013

Cara Tepat Menjadi iOS Developer Expert - Gilang Ramadhan
Cara Tepat Menjadi iOS Developer Expert - Gilang RamadhanCara Tepat Menjadi iOS Developer Expert - Gilang Ramadhan
Cara Tepat Menjadi iOS Developer Expert - Gilang Ramadhan
DicodingEvent
 

Ähnlich wie Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013 (20)

Introduction to Android Development and Security
Introduction to Android Development and SecurityIntroduction to Android Development and Security
Introduction to Android Development and Security
 
From Containerization to Modularity
From Containerization to ModularityFrom Containerization to Modularity
From Containerization to Modularity
 
Intro to android (gdays)
Intro to android (gdays)Intro to android (gdays)
Intro to android (gdays)
 
Android app development by abhi android
Android app development by abhi androidAndroid app development by abhi android
Android app development by abhi android
 
Android app development
Android app developmentAndroid app development
Android app development
 
Introduction to Android- A session by Sagar Das
Introduction to Android-  A session by Sagar DasIntroduction to Android-  A session by Sagar Das
Introduction to Android- A session by Sagar Das
 
Session 2 beccse
Session 2 beccseSession 2 beccse
Session 2 beccse
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android Workshop_1
Android Workshop_1Android Workshop_1
Android Workshop_1
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android Applications Development: A Quick Start Guide
Android Applications Development: A Quick Start GuideAndroid Applications Development: A Quick Start Guide
Android Applications Development: A Quick Start Guide
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
Cara Tepat Menjadi iOS Developer Expert - Gilang Ramadhan
Cara Tepat Menjadi iOS Developer Expert - Gilang RamadhanCara Tepat Menjadi iOS Developer Expert - Gilang Ramadhan
Cara Tepat Menjadi iOS Developer Expert - Gilang Ramadhan
 
My androidpresentation
My androidpresentationMy androidpresentation
My androidpresentation
 
Unit I- ANDROID OVERVIEW.ppt
Unit I- ANDROID OVERVIEW.pptUnit I- ANDROID OVERVIEW.ppt
Unit I- ANDROID OVERVIEW.ppt
 
Android Application Development Training by NITIN GUPTA
Android Application Development Training by NITIN GUPTA Android Application Development Training by NITIN GUPTA
Android Application Development Training by NITIN GUPTA
 
Android Programming
Android ProgrammingAndroid Programming
Android Programming
 
Enhancing and modifying_the_core_android_os
Enhancing and modifying_the_core_android_osEnhancing and modifying_the_core_android_os
Enhancing and modifying_the_core_android_os
 
Android - Anroid Pproject
Android - Anroid PprojectAndroid - Anroid Pproject
Android - Anroid Pproject
 
Presentation1
Presentation1Presentation1
Presentation1
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Kürzlich hochgeladen (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 

Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013