first steps in android development

15
© Copyright SELA software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com Sasha Goldshtein @goldshtn CTO, SELA Group blog.sashag.net First Steps in Android Development

Upload: sasha-goldshtein

Post on 19-May-2015

1.017 views

Category:

Technology


2 download

DESCRIPTION

Presentation from ConFoo 2014 on Android development. Introducing the Android platform, discussing the major components in the ecosystem, and building a basic todo list manager app with Eclipse.

TRANSCRIPT

Page 1: First Steps in Android Development

© Copyright SELA software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com

Sasha Goldshtein @goldshtnCTO, SELA Group blog.sashag.netFirst Steps in Android Development

Page 2: First Steps in Android Development

(Relevant) Android Versions

Froyo•Android 2.2

Gingerbread•Android 2.3.x

Honeycomb•Android 3.x

Ice Cream Sandwich•Android 4.0

Jelly Bean•Android 4.1-4.3

KitKat•Android 4.4

Page 3: First Steps in Android Development

Android Development Environment

Android applications are developed using JavaCan use any IDE: IntelliJ, JBuilder, NetBeans, Android StudioOr can use a command line: android create …

The Eclipse IDE is recommendedAndroid plugin for Eclipse (ADT)

Android projects, compilation, deployment, debugging

Android SDKPlatform libraries, sources, samples, emulator images for each Android versionGeneral tools

Page 4: First Steps in Android Development

Demo

Hello World

Page 5: First Steps in Android Development

Project Structure

srcgenres

layoutvalues

assetsAndroid X.X.XLibrariesAndroidManifest.xml

Page 6: First Steps in Android Development

Resources

Resources are non-code application partsAndroid resources include images, strings, simple values, animations, themes, etc.

Best to keep separated/external from codeExternal resources are easier to maintain, upgrade, and manage (…and localize!)

Created under the res folder

Page 7: First Steps in Android Development

Layout Resources

Layouts specify the UIDecouple presentation layer from codeEnable designing UI in XML Can be referenced as any other resource from other layouts

Usually, each layout XML file = view

Page 8: First Steps in Android Development

Layouts

Most commonly used layouts

Multiple layouts can be mixed together

Layout DescriptionFrameLayout Pins child views to the top left corner. Adding multiple

children stacks each new child on top of the previous, with each new view obscuring the last.

LinearLayout Adds each child view in a straight line, either vertically or horizontally.

RelativeLayout Enables defining the positions of each of the child views relative to each other and the screen boundaries.

TableLayout Lay out views using a grid of rows and columns.

Page 9: First Steps in Android Development

Localization

Resources make localization easyCreate a language-specific folder structure alongside the main folder structureFolder name includes qualifiers

+ res+ values

+ strings.xml

+ values-fr+ strings.xml

+ values-fr-rCA+ strings.xml

Page 10: First Steps in Android Development

Code and User Interface Separation

Strive to define most of the UI in XML files, and write only code in Java files

Clean code/UI separation provides flexibility and easy maintenanceMakes it easier to adjust for various types of hardware devices (similar to resource localization)

UI elements can be manipulated from code

Use findViewById to get UI element instance from code

Page 11: First Steps in Android Development

Demo

Connecting UI to Code

Page 12: First Steps in Android Development

Selectors and Lists

ListView provides a convenient UI for value selection from a long list

Presents multiple items on screen

Spinner provides UI for value selection

Presents only a single value at a timeDrop-down overlay of selectable items

Page 13: First Steps in Android Development

Demo

ListView and Adapters

Page 14: First Steps in Android Development

Summary

Android development environmentResources, layouts, viewsIt’s just another{language, IDE, UI framework}The rest is just details: data, networking, preferences, styling, …

Page 15: First Steps in Android Development

QuestionsSasha Goldshtein @goldshtnCTO, SELA Group blog.sashag.net