Android Workshop - Session 2

Post on 28-Jan-2015

113 views 1 download

Tags:

description

 

Transcript of Android Workshop - Session 2

05-02-2012 http://www.iwillstudy.com/group/android

Session #2

Producing an Android App

Java code Byte code

Dalvik

exe

Byte code <xml>

<str

>

.java .class

Other .class files

javac

dx

classes.dex

AndroidManifest.xml

Resources

.apk

aapt

Various Layouts

Various Widgets

Resources

Screen Characteristic

Screen

characteristicQualifier Description

Size

small Resources for small size screens.

normal Resources for normal size screens. (This is the baseline size.)

large Resources for large size screens.

xlarge Resources for extra large size screens.

Orientationland Resources for screens in the landscape orientation (wide aspect ratio).

port Resources for screens in the portrait orientation (tall aspect ratio).

Aspect

ratio

long

Resources for screens that have a significantly taller or wider aspect ratio

(when in portrait or landscape orientation, respectively) than the baseline

screen configuration.

notlongResources for use screens that have an aspect ratio that is similar to the

baseline screen configuration.

Screen Characteristic

Density

ldpi Resources for low-density (ldpi) screens (~120dpi).

mdpiResources for medium-density (mdpi) screens

(~160dpi). (This is the baseline density.)

hdpi Resources for high-density (hdpi) screens (~240dpi).

xhdpiResources for extra high-density (xhdpi) screens

(~320dpi).

nodpi

Resources for all densities. These are density-

independent resources. The system does not scale

resources tagged with this qualifier, regardless of the

current screen's density.

tvdpi

Resources for screens somewhere between mdpi and

hdpi; approximately 213dpi. This is not considered a

"primary" density group.

Fragmentation

res/layout/my_layout.xml // layout for normal screen

size ("default")

res/layout-small/my_layout.xml // layout for small screen size

res/layout-large/my_layout.xml // layout for large screen size

res/layout-xlarge/my_layout.xml // layout for extra large screen

size

res/layout-xlarge-land/my_layout.xml // layout for extra large in land.

orientation

res/drawable-mdpi/my_icon.png // bitmap for medium density

res/drawable-hdpi/my_icon.png // bitmap for high density

res/drawable-xhdpi/my_icon.png // bitmap for extra high density

Icon TypeStandard Asset Sizes (in Pixels), for Generalized Screen

Densities

Low density screen

(ldpi)

Medium density

screen (mdpi)

High density screen

(hdpi)

Launcher 36 x 36 px 48 x 48 px 72 x 72 px

Menu 36 x 36 px 48 x 48 px 72 x 72 px

Status Bar

(Android 2.3 and

later)

12w x 19h px

(preferred, width

may vary)

16w x 25h px

(preferred, width

may vary)

24w x 38h px

(preferred, width

may vary)

Status Bar

(Android 2.2 and

below)

19 x 19 px 25 x 25 px 38 x 38 px

Tab 24 x 24 px 32 x 32 px 48 x 48 px

Dialog 24 x 24 px 32 x 32 px 48 x 48 px

List View 24 x 24 px 32 x 32 px 48 x 48 px

Asset Type Prefix Example

Icons ic_ ic_star.png

Launcher icons ic_launcheric_launcher_calendar

.png

Menu icons ic_menu ic_menu_archive.png

Status bar icons ic_stat_notifyic_stat_notify_msg.p

ng

Tab icons ic_tab ic_tab_recent.png

Dialog icons ic_dialog ic_dialog_info.png

Options Menu

Context Menu

Create a new .xml file in your drawable folder

(or drawable-mdpi folder) called gradient.xml, with the following code:

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

<shape

xmlns:android="http://schemas.android.com/apk/res/android"

android:shape="rectangle">

<gradient

android:angle="0"

android:startColor="#000000"

android:endColor="#000000"

android:centerColor="#97CF4D" />

</shape>

Possibilities

Augmented Campus Reality• camera + maps + compass

= heads up info

Games• multi-player (bluetooth,

wifi, cell)• location-based (scavenger

hunt)

Custom overlays for maps• weather, traffic, friends

Web scraping• news filters• sport scores• news eliminators

Distributed computing?• 10,000 phones all

donating their idle time

Shared whiteboard

Android Controls

Rss Reader

Contacts Manager

Weather Application

Multimedia Player

Near Me

Picturesque

Stock Market Application

Plan My Month

Learn English Quick App

Rate Music App

Item List (ListView)

Button

Rss Reader Screen1

Rss Reader Screen2

Options Menu

Contact Manager Screen1

Groups List

(Expandable Lists -

Custom Adapter)

Options Menu

Buttons (ImageView)

Contact Manager Screen2

Input Area (EditText)PopUp (AlertDialog)

Contact Manager Screen3

Search Box(Search Dialog)

Search Action

Button

Input (Search EditText)

Weather app 1

Loading page

(Splash Screen)Image (ImageView)

Text (TextView)

Weather app 2

Background Video

Playing

Text (TextView)

Multimedia App 1

Popup (Dialog

Theme)

Selection

Item(RadioButto

n)

Drop Down (Spinner)

Button (Button)

Near Me 1

Action Item (Button)

Status List (ListView)

Separator

Image (ImageView)

Text (TextView)

Tabs (TabHost)

Near Me 2

Icon

(MapOverlayIcon)

Pop Up

(Toast)

Map(M

apActiv

ity)

Map

Compass

Picturesque 1

Item List (ListView)

Action Item (Button)

Action Item (ImageButton)

Picturesque 2

WebView

Action Item (Button)

Action Item (ImageButton)

Stock Market Application 1

Loading Page (Splash

Screen)

Loading (ProgessBar)

Stock Market Application 2

Loading

(ProgressDialog)

Stock Market Application 3

Horizontal ScrollView

Image (ImageView)

Action Item (Button)Scripts List (ListView

with Separators)

Separator

Text (TextView)

Plan My Month (To Do List) 1

Tasks

List(Expandable Lists

- Custom Adapter)

Tabs (TabHost)

Plan My Month (To Do List) 2

Tabs (TabHost)

Text (TextView)

Image (ImageView)

Tasks List (Expandable

List - Custom Adapter)

Learn English Quick App 1

Pop Up(AlertDialog)Text (TextView)

Text(Dialog Title)

Image (Dialog Icon)

Learn English Quick App 2

Download Status

(ProgressBar)

Action Item (Button)

Text (TextView)

Text (Linkify Text)

Online Android Resources

➲ Android developer website http://developer.android.com

➲ Open Handset Alliance http://www.openhandsetalliance.com

➲ Android Market http://market.android.com/publish

➲ Android libraries and extensions http://openintents.org

➲ Android developer forum http://www.anddev.org

Summary

➲ Solid, proven, popular, open platform

➲ Used on wide range of devices

➲ Support from Google, OEMs, telcoms

➲ Low barriers to entry

➲ Major opportunity for new developers

➲ Creativity, hard work, persistence

Thanks for coming

Android Study Group:

http://www.iwillstudy.com/group/android

Write to us:

info@iwillstudy.com

Like us on Facebook:

http://www.facebook.com/iwillstudy