android, getting started

44
Android SDK Development Tools Build Systems Application Building Blocks Create a Simple App Boston, July 2015 #00 ANDROID PROGRAMMIN G, LET'S BREAK IT DOWN !

Upload: giorgio-natili

Post on 13-Aug-2015

26 views

Category:

Mobile


1 download

TRANSCRIPT

Android SDK Development Tools

Build Systems Application Building Blocks

Create a Simple AppBoston, July 2015 #00

ANDROID PROGRAMMING, LET'S BREAK IT DOWN!

WHO I AM?

@giorgionatili #mobiletea

ANDROID SDK

• The Android SDK includes a variety of tools that help you develop mobile applications Android

• The tools are classified into two groups: SDK tools and platform tools#01

ANDROID SDK

• Android Virtual Device Manager (AVD)

• Android Emulator • The mksdcard utility

#01

VIRTUAL DEVICE TOOLS

• Android Debug Bridge (aka $ ./adb) • Dalvik Debug Monitor Service (aka $ ./ddms)

• Lint (aka $ ./lint) • Logs analysis tool (aka $ ./dmtracedump)

#01

DEBUGGING TOOLS

• ProGuard • Zipaling

#01

BUILD TOOLS

X#00

ANDROID EMULATOR(S)

• Based on existing configurations

• Consistent usage across platforms

• Extremely slow (developers usually don’t use it)

ANDROID VIRTUAL DEVICE MANAGER #02

• Based on Virtual Box

• Distributed with several devices

• Extremely fast and integrated (Eclipse, Android Studio and Visual Studio)

GENYMOTION

#02

• Based on Virtual Box

• Distributed with several devices

• Extremely fast and integrated (Eclipse, Android Studio and Visual Studio)

GENYMOTION

#02

• Integrated Android emulator

• Distributed with several devices

• Works only on Windows (soon it will be available online)

VISUAL STUDIO

#02

EXPORT PATHS#02

(optional)

Let’s play with the SDK Tools!

#02

DEVELOPMENT TOOLS

Do you recognize the

tools?

#03

• Solid and well known cross platform development tool

• Great plugin ecosystem

• Supports Android (till the end of the year)

ECLIPSE#03

• Java Development Kit 7+ (JDK) (6 will not work!)

• Eclipse, the "Eclipse IDE for Java Developers" is usually sufficient.

• Android SDK, you only need the SDK, not the ADT bundle, which includes Eclipse. Install the latest stable platforms via the SDK Manager.

• Android Development Tools for Eclipse, aka ADT Plugin. Use this update site: https://dl-ssl.google.com/android/eclipse/

• Eclipse Integration Gradle, use this update site: http://dist.springsource.com/snapshot/TOOLS/gradle/nightly (for Eclipse 4.4) or http://dist.springsource.com/release/TOOLS/gradle (for Eclipse < 4.4)

SETUP#03

• Based upon the IntelliJ platform

• Supports the user interface design

• Offers advanced code completion / refactoring tools

• Supports Gradle as a build system

ANDROID STUDIO

#03

• Java Development Kit 7+ (JDK) (6 will not work!)

• Android Studio Android Studio already comes packaged with the Android SDK

SETUP#03

ANDROID TOOLS#03

#03

CONFIGURE THE SDK AND JAVA PATH

#00

Complete your setup!

…and then everything will

change!

COMPLETE YOUR SETUP #03

BUILD SYSTEMS

• Pure Java build tool

• Flexible and without formal conventions (aka directory structure)

• Procedural tasks based tool

ANT#04

• Based on the concept of a project object model (POM.xml)

• Describes how the software is built and its dependencies

• Built with a plugin based architecture

MAVEN#04

• Mixes the flexibility of ANT and the architecture of Maven

• Project files are written in Groovy (more readable)

• Based on scripting more than on conventions

GRADLE#04

MAVEN VS GRADLE

#04

APPLICATION BUILDING BLOCKS

• app, contains the actual project folder

• build, contains the compiled classes and the actual output

• res, contains images, locales, etc.

• gradle, contains the gradle system jar wrapper

• External libraries, it’s where external source code is referenced

PROJECT STRUCTURE

#05

#05

PROJECT VS

ANDROID

• Application components are the essential building blocks of an Android application

• These components are loosely coupled by the application manifest file AndroidManifest.xml

• There are following four main components that can be used: Activities, Services, Broadcast Receivers, Content Providers

COMPONENTS

#05

• An activity represents a single screen with a user interface

• In-short Activity performs actions on the screen

ACTIVITY#05

• A service is a component that runs in the background to perform long-running operations

• For example, a service might fetch data over the network without blocking user interaction with an activity

SERVICE#05

• Broadcast Receivers simply respond to broadcast messages from other applications or from the system

• Each message is broadcaster as an Intent object

BROADCAST RECEIVER

#05

• A content provider component supplies data from one application to others on request

• The data may be stored in the file system, the database or somewhere else entirely

CONTENT PROVIDER

#05

• Fragments, represent a portion of user interface in an Activity

• Views, UI elements that are drawn on-screen including buttons, lists forms etc.

• Layouts, view hierarchies that control screen format and appearance of the views.

• Intents, messages wiring components together

OTHERS#05

• It is a passive data structure holding an abstract description of an operation to be performed

• The Action is mandatory part of the Intent object and is a string naming the action to be performed

• Adds a data specification to an intent filter, a filter is an expression in an app's manifest file that specifies the type of intents that the component would like to receive

INTENT#05

• Using Intents

• Using Shared Preferences

• Usually not with a Service

COMMUNI-CATION

#05

• Layouts are an XML representation of the UI elements of an activity

• A style is defined in an XML resource that is separate from the XML that specifies the layout

• Once your style is defined, you can use it in your XML Layout file

LAYOUTS AND STYLES #05

LET’S CODE IT!#00

• http://www.drdobbs.com/jvm/why-build-your-java-projects-with-gradle/240168608

• http://stackoverflow.com/questions/603189/differences-between-ant-and-maven

• http://technologyconversations.com/2014/06/18/build-tools/

• http://www.drdobbs.com/jvm/why-build-your-java-projects-with-gradle/240168608

• http://www.helloandroid.com/tutorials/communicating-between-running-activities

• http://stackoverflow.com/questions/21393287/how-should-i-communicate-between-activities

• http://www.tutorialspoint.com/android/android_tutorial.pdf

• https://developer.android.com/training/basics/firstapp/index.html?hl=p

• http://www.sitepoint.com/better-user-interfaces-android-action-bar/

• http://www.objc.io/issues/11-android/android_101_for_ios_developers/

• http://www.sitepoint.com/scheduling-background-tasks-android/

#00

Resources