Android - PowerPoint PPT Presentation

About This Presentation
Title:

Android

Description:

Trends 6. Findings Why Android Android was designed as a platform for software ... Sensing the environment Findings Android uses proven technology ... – PowerPoint PPT presentation

Number of Views:207
Avg rating:3.0/5.0
Slides: 34
Provided by: PeterWlo5
Category:

less

Transcript and Presenter's Notes

Title: Android


1
The Android GUI Framework Android experience
dayDecember 2008
Markus Pilz Peter Wlodarczak
2
Agenda
1. Introduction
2. Anatomy
3. A real word example
4. Life cycle
5. Trends
6. Findings
3
Why Android
  • Android was designed as a platform for software
    development
  • Android is open
  • Android is free
  • Community support
  • Tool support

4
Android Platform
5
Anatomy I
  • Android is Linux based
  • GUI is fully written in Java
  • Java 1.5 support
  • Widget toolkit
  • XML based GUI
  • Single Touch screen

6
Anatomy II
  • Activity
  • Intent, IntentFilter, IntertReceiver
  • View
  • Service
  • Content provider

7
Anatomy III
  • Storage
  • AIDL
  • Security
  • Life cycle management
  • Native calls (not officially)?
  • NLS support

8
A real word example I
  • A translator for Android
  • If you are in a country where no one understands
    your language
  • You cannot read anything
  • You have your mobile phone always with you
  • No additional device needed

9
A real word example II
  • Uses the Google translator
  • Uses XMPP for data transmission
  • Can be extended with new languages
  • Adaptive GUI
  • GUI fully defined in XML

10
A real word example III
Lets see it
11
A real word example IV
  • Used Eclipse for development
  • ANT script and make for build
  • Uses persistence of user data
  • Uses touch screen and keyboard input

12
A real word example V
The AndroidManifest.xml
ltmanifest xmlnsandroid"http//schemas.android.c
om/apk/res/android" package"com.greenliff.tra
nslator"gt ltapplication androidicon"_at_drawable
/logo"gt ltactivity androidlabel"_at_string/s
ettings" androidname"Settings"gt
ltintent-filtergt ltaction
androidname"android.intent.action.MAIN" /gt
lt/intent-filtergt lt/activitygt
ltactivity androidlabel"_at_string/app_name"
androidname"Translate"gt
ltintent-filtergt ltaction
androidname"android.intent.action.MAIN" /gt
ltcategory androidname"android.intent.
category.LAUNCHER" /gt
lt/intent-filtergt lt/activitygt
ltactivity androidlabel"_at_string/ocr"
androidname"OCR"gt ltintent-filtergt
ltaction androidname"android.intent
.action.MAIN" /gt lt/intent-filtergt
lt/activitygt lt/applicationgt lt/manifestgt
13
A real word example V
The AndroidManifest.xml
ltmanifest xmlnsandroid"http//schemas.android.c
om/apk/res/android" package"com.greenliff.tra
nslator"gt ltapplication androidicon"_at_drawable
/logo"gt ltactivity androidlabel"_at_string/s
ettings" androidname"Settings"gt
ltintent-filtergt ltaction
androidname"android.intent.action.MAIN" /gt
lt/intent-filtergt lt/activitygt
ltactivity androidlabel"_at_string/app_name"
androidname"Translate"gt
ltintent-filtergt ltaction
androidname"android.intent.action.MAIN" /gt
ltcategory androidname"android.intent.
category.LAUNCHER" /gt
lt/intent-filtergt lt/activitygt
ltactivity androidlabel"_at_string/ocr"
androidname"OCR"gt ltintent-filtergt
ltaction androidname"android.intent
.action.MAIN" /gt lt/intent-filtergt
lt/activitygt lt/applicationgt lt/manifestgt
Activity
14
A real word example V
The AndroidManifest.xml
ltmanifest xmlnsandroid"http//schemas.android.c
om/apk/res/android" package"com.greenliff.tra
nslator"gt ltapplication androidicon"_at_drawable
/logo"gt ltactivity androidlabel"_at_string/s
ettings" androidname"Settings"gt
ltintent-filtergt ltaction
androidname"android.intent.action.MAIN" /gt
lt/intent-filtergt lt/activitygt
ltactivity androidlabel"_at_string/app_name"
androidname"Translate"gt
ltintent-filtergt ltaction
androidname"android.intent.action.MAIN" /gt
ltcategory androidname"android.intent.
category.LAUNCHER" /gt
lt/intent-filtergt lt/activitygt
ltactivity androidlabel"_at_string/ocr"
androidname"OCR"gt ltintent-filtergt
ltaction androidname"android.intent
.action.MAIN" /gt lt/intent-filtergt
lt/activitygt lt/applicationgt lt/manifestgt
Activity
Launch
15
A real word example VI
The AndroidManifest.xml
  • Used for security
  • Define permissions, e. g.
  • ltuses-permission androidname"android.permissio
    n.RECEIVE_SMS" /gt
  • Give other Activities access

16
A real word example VII
An XML snipped of the main Activity
ltScrollView xmlnsandroid"http//schemas.android.
com/apk/res/android" androidlayout_width"fil
l_parent" androidlayout_height"wrap_content"
androidscrollbars"vertical"gt
ltLinearLayout xmlnsandroid"http//schemas.androi
d.com/apk/res/android" androidid"_at_id/li
nLayout" androidorientation"vertical"
androidlayout_width"fill_parent"
androidlayout_height"wrap_content"gt ltTextView
androidlayout_width"fill_parent"
androidlayout_height"wrap_content"
androidbackground"_at_drawable/blue"
androidtext"_at_string/translate_to_1"/gt ltEditTex
t androidid"_at_id/toTranslate"
androidlayout_width"fill_parent"
androidlayout_height"wrap_content"
androidbackground"_at_androiddrawable/editbox
_background" androidlayout_below"_at_id/l
inLayout androidhint"Type here..." /gt .....
Text reference
17
A real word example VII
An XML snipped of the main Activity
ltScrollView xmlnsandroid"http//schemas.android.
com/apk/res/android" androidlayout_width"fil
l_parent" androidlayout_height"wrap_content"
androidscrollbars"vertical"gt
ltLinearLayout xmlnsandroid"http//schemas.androi
d.com/apk/res/android" androidid"_at_id/li
nLayout" androidorientation"vertical"
androidlayout_width"fill_parent"
androidlayout_height"wrap_content"gt ltTextView
androidlayout_width"fill_parent"
androidlayout_height"wrap_content"
androidbackground"_at_drawable/blue"
androidtext"_at_string/translate_to_1"/gt ltEditTex
t androidid"_at_id/toTranslate"
androidlayout_width"fill_parent"
androidlayout_height"wrap_content"
androidbackground"_at_androiddrawable/editbox
_background" androidlayout_below"_at_id/l
inLayout androidhint"Type here..." /gt .....
Id
Text reference
18
A real word example VIII
  • Could also be developed purely in Java
  • XML cannot be debugged
  • Not all the attributes can be defined in XML

19
A real word example IX
A code snipped of the Translate Activity
_at_Override public void onCreate(Bundle
icicle) super.onCreate(icicle)
Window wp getWindow() mContext
wp.getContext() setTheme(android.R.style.
Theme_Light) setContentView(R.layout.main
) mLayout (LinearLayout)
this.findViewById(R.id.linLayout)
mToTranslate (EditText) this.findViewById(R.id.t
oTranslate) setShowLanguages()
mEnge (LinearLayout) this.findViewById(R.id
.enge) LANGUAGE_LAYOUT0 mEnge
de2en (Button) this.findViewById(R.id.de2en)
de2en.setOnClickListener(new
View.OnClickListener() public void
onClick(View view)
if(!connect())
notLoggedInAlert() else
doConnect("de2en_at_bot.talk.google.com"
) rearrange(mEnge)
) ....
20
A real word example IX
A code snipped of the Translate Activity
_at_Override public void onCreate(Bundle
icicle) super.onCreate(icicle)
Window wp getWindow() mContext
wp.getContext() setTheme(android.R.style.
Theme_Light) setContentView(R.layout.main
) mLayout (LinearLayout)
this.findViewById(R.id.linLayout)
mToTranslate (EditText) this.findViewById(R.id.t
oTranslate) setShowLanguages()
mEnge (LinearLayout) this.findViewById(R.id
.enge) LANGUAGE_LAYOUT0 mEnge
de2en (Button) this.findViewById(R.id.de2en)
de2en.setOnClickListener(new
View.OnClickListener() public void
onClick(View view)
if(!connect())
notLoggedInAlert() else
doConnect("de2en_at_bot.talk.google.com"
) rearrange(mEnge)
) ....
Set layout
21
A real word example IX
A code snipped of the Translate Activity
_at_Override public void onCreate(Bundle
icicle) super.onCreate(icicle)
Window wp getWindow() mContext
wp.getContext() setTheme(android.R.style.
Theme_Light) setContentView(R.layout.main
) mLayout (LinearLayout)
this.findViewById(R.id.linLayout)
mToTranslate (EditText) this.findViewById(R.id.t
oTranslate) setShowLanguages()
mEnge (LinearLayout) this.findViewById(R.id
.enge) LANGUAGE_LAYOUT0 mEnge
de2en (Button) this.findViewById(R.id.de2en)
de2en.setOnClickListener(new
View.OnClickListener() public void
onClick(View view)
if(!connect())
notLoggedInAlert() else
doConnect("de2en_at_bot.talk.google.com"
) rearrange(mEnge)
) ....
Find elements
Set layout
22
A real word example IX
A code snipped of the Translate Activity
_at_Override public void onCreate(Bundle
icicle) super.onCreate(icicle)
Window wp getWindow() mContext
wp.getContext() setTheme(android.R.style.
Theme_Light) setContentView(R.layout.main
) mLayout (LinearLayout)
this.findViewById(R.id.linLayout)
mToTranslate (EditText) this.findViewById(R.id.t
oTranslate) setShowLanguages()
mEnge (LinearLayout) this.findViewById(R.id
.enge) LANGUAGE_LAYOUT0 mEnge
de2en (Button) this.findViewById(R.id.de2en)
de2en.setOnClickListener(new
View.OnClickListener() public void
onClick(View view)
if(!connect())
notLoggedInAlert() else
doConnect("de2en_at_bot.talk.google.com"
) rearrange(mEnge)
) ....
Find elements
Set layout
Add behavior
23
A real word example X
Call an other Activity
_at_Override public boolean
onOptionsItemSelected(Menu.Item item)
switch (item.getId()) case 0
showLogin() break
case 1 Intent intent new
Intent(Translate.this, Settings.class)
intent.putExtras(mShownLanguages)
startSubActivity(intent, SETTINGS)
break // switch return
true
24
A real word example X
Call an other Activity
_at_Override public boolean
onOptionsItemSelected(Menu.Item item)
switch (item.getId()) case 0
showLogin() break
case 1 Intent intent new
Intent(Translate.this, Settings.class)
intent.putExtras(mShownLanguages)
startSubActivity(intent, SETTINGS)
break // switch return
true
Start an Activity
25
A real word example X
Call an other Activity
_at_Override public boolean
onOptionsItemSelected(Menu.Item item)
switch (item.getId()) case 0
showLogin() break
case 1 Intent intent new
Intent(Translate.this, Settings.class)
intent.putExtras(mShownLanguages)
startSubActivity(intent, SETTINGS)
break // switch return
true
Start an Activity
Pass data to new Activity
26
A real word example XI
Store user data
_at_Override protected void onPause()
super.onPause() SharedPreferences.Editor
ed mPrefs.edit() for(int i 0 i lt
SUPPORTED_LANGUAGES.length i)
ed.putBoolean(SUPPORTED_LANGUAGESi,
mShownLanguages.getBoolean(SUPPORTED_LANGUAGESi
)) ed.commit()
Persistent store
27
A real word example XII
Store user data
  • Preferences
  • Database
  • Files
  • Content provider
  • Network

28
Life cycle
  • Life cycle not directly controlled by application
  • System can kill an application to free up memory
  • Controll through onCreate(), onPause(), onStop()
    ... methods
  • Android has different types of processes,
    visible processes, service processes, background
    processes ...
  • Services can be used for long-lived background
    processes

29
Trends I
  • Eyes-free user interfaces
  • Other user interfaces like tones, vibrant alarm,
    sensors, actuators
  • Leverage hearing and touch
  • Camera input
  • Ubiquitous computing technologies

30
Trends II
  • Speech recognition
  • Accelerometer
  • Magnetic compass
  • Location self-awareness
  • Locating others
  • Sensing the environment

31
Findings
  • Android uses proven technology like Java, XML
    and Linux
  • It offers a rich API for application development
  • There is an initial learning effort
  • Android doesnt have many of the limitations
    other mobile platforms have
  • Trend towards eyes-free user interfaces

32
Some figures
  • Q4 2007 more than 3 billion mobile subscribers
    (world population 6.7 billion)?
  • 1.14 billion handsets delivered in 2007
    (computers 271.2 million)?
  • 118 million where smart phones
  • Currently more than 30 mobile platforms
  • Symbian leads with 65 share, ahead of Microsoft
    on 12, RIM on 11, Apple on 7, and Linux at 5

33
Thank you for the attention
Questions?
Find out more at http//code.google.com/android
Write a Comment
User Comments (0)
About PowerShow.com