Top Banner
Introducing Android Cory Maksymchuk [email protected] [email protected]
25

C maksymchuk android

May 17, 2015

Download

Technology

sdeconf

Introducing Android
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 2: C maksymchuk android
Page 3: C maksymchuk android
Page 4: C maksymchuk android
Page 5: C maksymchuk android
Page 6: C maksymchuk android
Page 7: C maksymchuk android
Page 8: C maksymchuk android

Today

• Java is dead?

• What is Android and why was it made?

• Open?

• Money?

• Overview of android architecture

• Sample Application

Page 9: C maksymchuk android

Java is Dead

Page 10: C maksymchuk android

Android

Worldwide Smart Phone Market share

• 2009 – 3.9%

• 2010 – 23%

• 2011 – 38%

• 2012 – 49%

• 3 years = 500 million smart phones running Android

Page 11: C maksymchuk android

Why Java?

• Mature Language

• Massive open source community

• Excellent tools/IDEs

• Large, slow bloated Virtual Machine

- Dalvik = Small, fast optimized Virtual Machine

• All benefits, no disadvantages

- Except?

Page 12: C maksymchuk android

What is Android?

How was growth achieved?

• Operating system, built on Linux

• Compiler, debugger, emulator, VM

• Open sourced code under Apache 2 license

• Open Handset Alliance – 84’ish Companies

- Why?

- Open standards to allow it to grow

- Ability to compete – Apple, Symbian/Nokia, RIM, Microsoft

- Google = Smart

• Android vs. iPhone?

Page 13: C maksymchuk android

Open?

• Yes… but No…

• Open

- A license that insures the code can be modified, reused and

distributed

- A community development approach

- Assurance the users have total freedom over the device and

software.

• Google has achieved ½ of openness – Legally Open

Source

• Is their ‘community development approach’ any different

than Apple or RIM?

Page 14: C maksymchuk android

Money?

• What kind of a company is Google?

• How do they make money?

• Android simply makes them better at doing what they’ve

always done best.

Page 15: C maksymchuk android
Page 16: C maksymchuk android

3 Things

• Activities = Screens

• Views/Widgets = Components

• Intents = Messages - used for navigation (among other

things)

Page 17: C maksymchuk android

Activities = Screens

• Screens have lifecycles on Mobile devices

- onCreate() — Activity is first created

- onStart() — Becomes visible

- onResume() — Interacting with the user

- onPause() — Current activity-> another activity resumed

- onStop() — No longer visible to the user

- onDestroy() — Before the activity is destroyed

- onRestart() — Restarting again

Page 18: C maksymchuk android
Page 19: C maksymchuk android

Views

• Basic building block for UI components

View

Widget ViewGroup

Layout

Page 20: C maksymchuk android

Views – Cont’d

• To add views to a screen/activity, create hierarchy of

views, then call setViewGroup(…) in the activity.

• Layout may contain layout and buttons, text fields, radio

buttons, etc.

Page 21: C maksymchuk android

Intents = Messages

• Main communication mechanism in Android

1) Used to call other apps or screens – This is us!

2) Send a message to someone who is listening

- Low battery

- Time zone change

3) Start a service

- Download a file

- Start/Check the status of a process

Page 22: C maksymchuk android

Intents/Messages

What do they contain?

• Component name – Unique identifier of component

- This is an explicit intent

• Activity

- ACTION_CALL

- ACTION_EDIT

- ACTION_SYNC

- ACTION_VIEW

• Data

- URI and MIME type (http://www.protegra.com)

• Category

- Logical Grouping of activities

• Extras

- Key/Value pairs

Page 23: C maksymchuk android

Intent Filters – Intent Resolution

• Data

• <intent-filter . . . >

<action android:name="com.example.project.SHOW_CURRENT" />

<action android:name="com.example.project.SHOW_RECENT" />

. . .

<category android:name="android.intent.category.DEFAULT" />

<category android:name="android.intent.category.BROWSABLE" />

. . .

<data android:mimeType="video/mpeg" android:scheme="http" . . . />

<data android:mimeType="audio/mpeg" android:scheme="http" . . . />

</intent-filter>

Page 24: C maksymchuk android

Summary

• Screens = Activities

• Screens have components (Views) to manage layouts

as well as widgets, etc.

• Activities call other Activities, invoke services and send

messages using Intents

Page 25: C maksymchuk android

Code