SlideShare ist ein Scribd-Unternehmen logo
1 von 59
What is Android
• Android is an open source operating system,
created by Google specifically for use on
mobile devices (cell phones and tablets)
• Linux based (2.6 kernel)
• Can be programmed in C/C++ but most app
development is done in Java (Java access to C
Libraries via JNI (Java Native Interface))
• Supports Bluetooth, Wi-Fi, and 3G and 4G
networking
Android development
Android
Manifest
Resource
XML
Java Source
Generated
Class
Java
Compiler
Android
Libraries
.dex
File
Dalvik
VM
WHAT IS ANDROID?
 A Software platform and operating system
for mobile.
 Based on the Linux kernel.
 Android was found way back in 2003.
 It was developed in Palo Alto, California.
 Android was developed by the Andy
Rubin, Rich Miner, Nick Sears and Chris
White.
 Android was purchased by the GOOGLE
in AUGUST,2005 for 50 million $.
Sales
Android os
Windows phone
iOS
Symbian Os
Blackberry os
Others
Androrid
iOs0
50000
100000
150000
200000
250000
300000
350000
2009
2010
2011
2012
Androrid
iOs
 First Version of Android.
 The focus of Android beta is testing incorporating usability.
 Android beta will generally have many more problems on speed and
performance.
 First full version of android.
 Released on September 23, 2008.
 Wi-Fi and Bluetooth support.
 Quite slow in operating.
 copy and paste feature in the web browser is
not present.
 Released on April 30, 2009.
 Added auto-rotation option.
 Copy and Paste feature added in the web
browser.
 Increased speed and performance but not upto
required level.
 Released on September 15, 2009.
 Voice search and Search box were added.
 Faster OS boot times and fast web browsing
experience.
 Typing is quite slower.
 Released on October 26, 2009.
 Bluetooth 2.1 support.
 Improved typing speed on virtual
keyboard, with smarter dictionary.
 no Adobe flash media support.
 Released on May 20, 2010.
 Support for Adobe Flash 10.1
 Improved Application launcher with better browser
 No internet calling.
 Released on December 6, 2010.
 Updated User Interface with high efficiency and speed
 Internet calling
 One touch word selection and copy/paste.
 New keyboard for faster word input.
 More successful version of Android than previous
versions.
 not supports multi-core processors.
 Released on February 22, 2011.
 Support for multi-core processors
 Ability to encrypt all user data.
 This version of android is only available for
tablets.
 Released on November 14, 2011.
 Virtual button in the UI.
 A new typeface family for the UI, Roboto.
 Ability to shut down apps that are using data in the
background.
 Released on June 27, 2012.
 Latest version of Android.
 Smoother user interface.
 Making source code available to everyone
inevitably invites the attention of hackers.
 Android operating system uses more
amount of battery as compared to normal
mobile phones.
 As there are so many user sometimes it
becomes difficult to connect all the users.
 As we call Android is world of applications
we continuously need to connected with
the internet which is not possible for all the
users.
 Android is now stepping up in next level of
mobile internet.
 There are chances of Android Mobile sales
becomes more then iPhone in next two
years.
 Google may launch another version of
android that starts K because Google is
launching all the android versions in the
alphabetical order.
 There are chances of Android may become
the widely used operating system in world.
@2011 Mihail L. Sichitiu 13
Applications
• Written in Java (it’s possible to write native
code – will not cover that here)
• Good separation (and corresponding security)
from other applications:
– Each application runs in its own process
– Each process has its own separate VM
@2011 Mihail L. Sichitiu 14
Application Components
• Activities – visual user interface focused on a
single thing a user can do
• Services – no visual interface – they run in the
background
• Broadcast Receivers – receive and react to
broadcast announcements
• Content Providers – allow data exchange
between applications
@2011 Mihail L. Sichitiu 15
Activities
• Basic component of most applications
• Most applications have several activities that
start each other as needed
• Each is implemented as a subclass of the base
Activity class
@2011 Mihail L. Sichitiu 16
Activities – The View
• Each activity has a default window to draw in
(although it may prompt for dialogs or
notifications)
• The content of the window is a view or a
group of views (derived from View or
ViewGroup)
• Example of views: buttons, text fields, scroll
bars, menu items, check boxes, etc.
• View(Group) made visible via
Activity.setContentView() method.
@2011 Mihail L. Sichitiu 17
Services
• Does not have a visual interface
• Runs in the background indefinitely
• Examples
– Network Downloads
– Playing Music
– TCP/UDP Server
• You can bind to a an existing service and
control its operation
@2011 Mihail L. Sichitiu 18
Broadcast Receivers
• Receive and react to broadcast
announcements
• Extend the class BroadcastReceiver
• Examples of broadcasts:
– Low battery, power connected, shutdown,
timezone changed, etc.
– Other applications can initiate broadcasts
@2011 Mihail L. Sichitiu 19
Content Providers
• Makes some of the application data available
to other applications
• It’s the only way to transfer data between
applications in Android (no shared files,
shared memory, pipes, etc.)
• Extends the class ContentProvider;
• Other applications use a ContentResolver
object to access the data provided via a
ContentProvider
@2011 Mihail L. Sichitiu 20
Intents
• An intent is an Intent object with a message content.
• Activities, services and broadcast receivers are started by
intents. ContentProviders are started by ContentResolvers:
– An activity is started by Context.startActivity(Intent intent) or
Activity.startActivityForResult(Intent intent, int RequestCode)
– A service is started by Context.startService(Intent service)
– An application can initiate a broadcast by using an Intent in any of
Context.sendBroadcast(Intent intent),
Context.sendOrderedBroadcast(), and Context.sendStickyBroadcast()
@2011 Mihail L. Sichitiu 21
Shutting down components
• Activities
– Can terminate itself via finish();
– Can terminate other activities it started via finishActivity();
• Services
– Can terminate via stopSelf(); or Context.stopService();
• Content Providers
– Are only active when responding to ContentResolvers
• Broadcast Receivers
– Are only active when responding to broadcasts
@2011 Mihail L. Sichitiu 22
Android Manifest
• Its main purpose in life is to declare the components to the system:
<?xml version="1.0" encoding="utf-8"?>
<manifest . . . >
<application . . . >
<activity android:name="com.example.project.FreneticActivity"
android:icon="@drawable/small_pic.png"
android:label="@string/freneticLabel"
. . . >
</activity>
. . .
</application>
</manifest>
Manifest File (1)
• Contains characteristics about your application
• When have more than one Activity in app, NEED to
specify it in manifest file
– Go to graphical view of the manifest file
– Add an Activity in the bottom right
– Browse for the name of the activity
• Need to specify Services and other components too
• Also important to define permissions and external
libraries, like Google Maps API
Manifest File (2) – Adding an Activity
@2011 Mihail L. Sichitiu 25
Intent Filters
• Declare Intents handled by the current application (in the
AndroidManifest):
<?xml version="1.0" encoding="utf-8"?>
<manifest . . . >
<application . . . >
<activity android:name="com.example.project.FreneticActivity"
android:icon="@drawable/small_pic.png"
android:label="@string/freneticLabel"
. . . >
<intent-filter . . . >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter . . . >
<action android:name="com.example.project.BOUNCE" />
<data android:mimeType="image/jpeg" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
. . .
</application>
</manifest>
Shows in the
Launcher and
is the main
activity to
start
Handles JPEG
images in
some way
Android Tutorial
Larry Walters
OOSE Fall 2011
References
• This tutorial is a brief overview of some major
concepts…Android is much richer and more
complex
• Developer’s Guide
– http://developer.android.com/guide/index.html
• API Reference
– http://developer.android.com/reference/packages.html
Tools
• Phone
• Eclipse ( http://www.eclipse.org/downloads/ )
– Android Plugin (ADT)
• Android SDK ( http://developer.android.com/sdk/index.html )
– Install everything except Additional SDK Platforms,
unless you want to
• Windows Users: may need to install Motorola
Driver directly ( http://www.motorola.com/Support/US-
EN/Support-Homepage/Software_and_Drivers/USB-and-PC-Charging-
Drivers )
Android SDK
• Once installed open the SDK Manager
• Install the desired packages
• Create an Android Virtual Device (AVD)
SDK Manager
AVD
ADT Plugin (1)
• In Eclipse, go to Help -> Install New Software
• Click ‘Add’ in top right
• Enter:
– Name: ADT Plugin
– Location: https://dl-ssl.google.com/android/eclipse/
• Click OK, then select ‘Developer Tools’, click Next
• Click Next and then Finish
• Afterwards, restart Eclipse
• Specify SDK location (next 3 slides)
– Must do this every time start a new project in a new location (at
least in Windows)
ADT Plugin (2)
ADT Plugin (3)
ADT Plugin (4)
Creating a Project (1)
Creating a Project (2)
Need
the
items
circled
Then
click
Finish
Project Components
• src – your source code
• gen – auto-generated code (usually just R.java)
• Included libraries
• Resources
– Drawables (like .png images)
– Layouts
– Values (like strings)
• Manifest file
XML
• Used to define some of the resources
– Layouts (UI)
– Strings
• Manifest file
• Shouldn’t usually have to edit it directly,
Eclipse can do that for you
• Preferred way of creating UIs
– Separates the description of the layout from any
actual code that controls it
– Can easily take a UI from one platform to another
R Class
• Auto-generated: you shouldn’t edit it
• Contains IDs of the project resources
• Enforces good software engineering
• Use findViewById and Resources object to get
access to the resources
– Ex. Button b = (Button)findViewById(R.id.button1)
– Ex. getResources().getString(R.string.hello));
Layouts (1)
• Eclipse has a great UI creator
– Generates the XML for you
• Composed of View objects
• Can be specified for portrait and landscape
mode
– Use same file name, so can make completely
different UIs for the orientations without
modifying any code
Layouts (2)
Layouts (3)
• Click ‘Create’ to make layout modifications
• When in portrait mode can select ‘Portrait’ to make a res
sub folder for portrait layouts
– Likewise for Landscape layouts while in landscape mode
– Will create folders titled ‘layout-port’ and ‘layout-land’
• Note: these ‘port’ and ‘land’ folders are examples of
‘alternate layouts’, see here for more info
– http://developer.android.com/guide/topics/resources/providing-resources.html
• Avoid errors by making sure components have the same
id in both orientations, and that you’ve tested each
orientation thoroughly
Layouts (4)
Strings
• In res/values
– strings.xml
• Application wide available strings
• Promotes good software engineering
• UI components made in the UI editor should
have text defined in strings.xml
• Strings are just one kind of ‘Value’ there are
many others
Android Programming Components
• Activity
– http://developer.android.com/guide/topics/fundamentals/activities.html
• Service
– http://developer.android.com/guide/topics/fundamentals/services.html
• Content Providers
• Broadcast Receivers
• Android in a nutshell:
– http://developer.android.com/guide/topics/fundamentals.html
Activities (1)
• The basis of android applications
• A single Activity defines a single viewable
screen
– the actions, not the layout
• Can have multiple per application
• Each is a separate entity
• They have a structured life cycle
– Different events in their life happen either via the
user touching buttons or programmatically
Activities (2)
Services (1)
• Run in the background
– Can continue even if Activity that started it dies
– Should be used if something needs to be done while the user is not
interacting with application
• Otherwise, a thread is probably more applicable
– Should create a new thread in the service to do work in, since the service
runs in the main thread
• Can be bound to an application
– In which case will terminate when all applications bound to it unbind
– Allows multiple applications to communicate with it via a common
interface
• Needs to be declared in manifest file
• Like Activities, has a structured life cycle
Services (2)
Running in Eclipse (1)
• Similar to launching a regular Java app, use
the launch configurations
• Specify an Android Application and create a
new one
• Specify activity to be run
• Can select a manual option, so each time
program is run, you are asked whether you
want to use the actual phone or the emulator
– Otherwise, it should be smart and use whichever
one is available
Running in Eclipse (2)
Running in Eclipse (3)
Running in Eclipse (4)
Debugging
• Instead of using traditional System.out.println, use the Log class
– Imported with android.util.Log
– Multiple types of output (debug, warning, error, …)
– Log.d(<tag>,<string>)
• Can be read using logcat.
– Print out the whole log, which auto-updates
• adb logcat
– Erase log
• adb logcat –c
– Filter output via tags
• adb logcat <tag>:<msg type> *:S
• can have multiple <tag>:<msg type> filters
• <msg type> corresponds to debug, warning, error, etc.
• If use Log.d(), then <msg type> = D
• Reference
– http://developer.android.com/guide/developing/debugging/debugging-log.html
UI With GUI Builder
Android Event Handlers
From the code file for the activity:
Button ok = (Button) findViewById(R.id.button1);
ok.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
CharSequence s = et.getText();
tv.setText("Welcome, " + s);
}
});
Sams Teach Yourself Android™Application Development in 24 Hours (0321673352)
Copyright ©2010 Lauren Darcey and Shane Conder
FIGURE 3.2 Important callback methods of the activity life cycle.

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Android overview
Android overviewAndroid overview
Android overview
 
Android Overview
Android OverviewAndroid Overview
Android Overview
 
Short notes of android
Short notes of androidShort notes of android
Short notes of android
 
Introduction to Android Environment
Introduction to Android EnvironmentIntroduction to Android Environment
Introduction to Android Environment
 
Introduction to Android
Introduction to Android Introduction to Android
Introduction to Android
 
Android
AndroidAndroid
Android
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Java
 
Learn Android app development in easy steps
Learn Android app development in easy stepsLearn Android app development in easy steps
Learn Android app development in easy steps
 
Android app development ppt
Android app development pptAndroid app development ppt
Android app development ppt
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Introduction to Android, Architecture & Components
Introduction to  Android, Architecture & ComponentsIntroduction to  Android, Architecture & Components
Introduction to Android, Architecture & Components
 
Seminar Report on Android OS
Seminar Report on Android OSSeminar Report on Android OS
Seminar Report on Android OS
 
PPT Companion to Android
PPT Companion to AndroidPPT Companion to Android
PPT Companion to Android
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android Development: Build Android App from Scratch
Android Development: Build Android App from ScratchAndroid Development: Build Android App from Scratch
Android Development: Build Android App from Scratch
 
Android Report
Android ReportAndroid Report
Android Report
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Android Platform Architecture
Android Platform ArchitectureAndroid Platform Architecture
Android Platform Architecture
 
Android versions
Android versionsAndroid versions
Android versions
 

Andere mochten auch (6)

Android Basics
Android BasicsAndroid Basics
Android Basics
 
Android
AndroidAndroid
Android
 
Introduction to Android development - CEC ISQIP 2014
Introduction to Android development -  CEC ISQIP 2014Introduction to Android development -  CEC ISQIP 2014
Introduction to Android development - CEC ISQIP 2014
 
Android Basics
Android BasicsAndroid Basics
Android Basics
 
Android Basics
Android BasicsAndroid Basics
Android Basics
 
Introduction to android basics
Introduction to android basicsIntroduction to android basics
Introduction to android basics
 

Ähnlich wie Basics of Android

Google Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talkGoogle Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talk
Imam Raza
 
Mobile Application Development-Lecture 01 & 02.pdf
Mobile Application Development-Lecture 01 & 02.pdfMobile Application Development-Lecture 01 & 02.pdf
Mobile Application Development-Lecture 01 & 02.pdf
AbdullahMunir32
 
Android presentation
Android presentationAndroid presentation
Android presentation
Imam Raza
 

Ähnlich wie Basics of Android (20)

Android platform
Android platform Android platform
Android platform
 
Sogeti - Android tech track presentation - 24 february 2011
Sogeti - Android tech track presentation - 24 february 2011Sogeti - Android tech track presentation - 24 february 2011
Sogeti - Android tech track presentation - 24 february 2011
 
Android - Android Application Fundamentals
Android - Android Application FundamentalsAndroid - Android Application Fundamentals
Android - Android Application Fundamentals
 
Aptech Apps
Aptech Apps Aptech Apps
Aptech Apps
 
Basic of Android App Development
Basic of Android App DevelopmentBasic of Android App Development
Basic of Android App Development
 
Mobile application development
Mobile application developmentMobile application development
Mobile application development
 
Seminar on android app development
Seminar on android app developmentSeminar on android app development
Seminar on android app development
 
Android
AndroidAndroid
Android
 
Eca online-seminar-session-1.pptx
Eca online-seminar-session-1.pptxEca online-seminar-session-1.pptx
Eca online-seminar-session-1.pptx
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
First Steps with Android - An Exciting Introduction
First Steps with Android - An Exciting IntroductionFirst Steps with Android - An Exciting Introduction
First Steps with Android - An Exciting Introduction
 
OS in mobile devices [Android]
OS in mobile devices [Android]OS in mobile devices [Android]
OS in mobile devices [Android]
 
Google Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talkGoogle Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talk
 
Basic android
Basic androidBasic android
Basic android
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Mobile Application Development-Lecture 01 & 02.pdf
Mobile Application Development-Lecture 01 & 02.pdfMobile Application Development-Lecture 01 & 02.pdf
Mobile Application Development-Lecture 01 & 02.pdf
 
Android presentation
Android presentationAndroid presentation
Android presentation
 
Android complete basic Guide
Android complete basic GuideAndroid complete basic Guide
Android complete basic Guide
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Kürzlich hochgeladen (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Basics of Android

  • 1.
  • 2. What is Android • Android is an open source operating system, created by Google specifically for use on mobile devices (cell phones and tablets) • Linux based (2.6 kernel) • Can be programmed in C/C++ but most app development is done in Java (Java access to C Libraries via JNI (Java Native Interface)) • Supports Bluetooth, Wi-Fi, and 3G and 4G networking
  • 4. WHAT IS ANDROID?  A Software platform and operating system for mobile.  Based on the Linux kernel.  Android was found way back in 2003.  It was developed in Palo Alto, California.  Android was developed by the Andy Rubin, Rich Miner, Nick Sears and Chris White.  Android was purchased by the GOOGLE in AUGUST,2005 for 50 million $.
  • 7.  First Version of Android.  The focus of Android beta is testing incorporating usability.  Android beta will generally have many more problems on speed and performance.  First full version of android.  Released on September 23, 2008.  Wi-Fi and Bluetooth support.  Quite slow in operating.  copy and paste feature in the web browser is not present.
  • 8.  Released on April 30, 2009.  Added auto-rotation option.  Copy and Paste feature added in the web browser.  Increased speed and performance but not upto required level.  Released on September 15, 2009.  Voice search and Search box were added.  Faster OS boot times and fast web browsing experience.  Typing is quite slower.  Released on October 26, 2009.  Bluetooth 2.1 support.  Improved typing speed on virtual keyboard, with smarter dictionary.  no Adobe flash media support.
  • 9.  Released on May 20, 2010.  Support for Adobe Flash 10.1  Improved Application launcher with better browser  No internet calling.  Released on December 6, 2010.  Updated User Interface with high efficiency and speed  Internet calling  One touch word selection and copy/paste.  New keyboard for faster word input.  More successful version of Android than previous versions.  not supports multi-core processors.  Released on February 22, 2011.  Support for multi-core processors  Ability to encrypt all user data.  This version of android is only available for tablets.
  • 10.  Released on November 14, 2011.  Virtual button in the UI.  A new typeface family for the UI, Roboto.  Ability to shut down apps that are using data in the background.  Released on June 27, 2012.  Latest version of Android.  Smoother user interface.
  • 11.  Making source code available to everyone inevitably invites the attention of hackers.  Android operating system uses more amount of battery as compared to normal mobile phones.  As there are so many user sometimes it becomes difficult to connect all the users.  As we call Android is world of applications we continuously need to connected with the internet which is not possible for all the users.
  • 12.  Android is now stepping up in next level of mobile internet.  There are chances of Android Mobile sales becomes more then iPhone in next two years.  Google may launch another version of android that starts K because Google is launching all the android versions in the alphabetical order.  There are chances of Android may become the widely used operating system in world.
  • 13. @2011 Mihail L. Sichitiu 13 Applications • Written in Java (it’s possible to write native code – will not cover that here) • Good separation (and corresponding security) from other applications: – Each application runs in its own process – Each process has its own separate VM
  • 14. @2011 Mihail L. Sichitiu 14 Application Components • Activities – visual user interface focused on a single thing a user can do • Services – no visual interface – they run in the background • Broadcast Receivers – receive and react to broadcast announcements • Content Providers – allow data exchange between applications
  • 15. @2011 Mihail L. Sichitiu 15 Activities • Basic component of most applications • Most applications have several activities that start each other as needed • Each is implemented as a subclass of the base Activity class
  • 16. @2011 Mihail L. Sichitiu 16 Activities – The View • Each activity has a default window to draw in (although it may prompt for dialogs or notifications) • The content of the window is a view or a group of views (derived from View or ViewGroup) • Example of views: buttons, text fields, scroll bars, menu items, check boxes, etc. • View(Group) made visible via Activity.setContentView() method.
  • 17. @2011 Mihail L. Sichitiu 17 Services • Does not have a visual interface • Runs in the background indefinitely • Examples – Network Downloads – Playing Music – TCP/UDP Server • You can bind to a an existing service and control its operation
  • 18. @2011 Mihail L. Sichitiu 18 Broadcast Receivers • Receive and react to broadcast announcements • Extend the class BroadcastReceiver • Examples of broadcasts: – Low battery, power connected, shutdown, timezone changed, etc. – Other applications can initiate broadcasts
  • 19. @2011 Mihail L. Sichitiu 19 Content Providers • Makes some of the application data available to other applications • It’s the only way to transfer data between applications in Android (no shared files, shared memory, pipes, etc.) • Extends the class ContentProvider; • Other applications use a ContentResolver object to access the data provided via a ContentProvider
  • 20. @2011 Mihail L. Sichitiu 20 Intents • An intent is an Intent object with a message content. • Activities, services and broadcast receivers are started by intents. ContentProviders are started by ContentResolvers: – An activity is started by Context.startActivity(Intent intent) or Activity.startActivityForResult(Intent intent, int RequestCode) – A service is started by Context.startService(Intent service) – An application can initiate a broadcast by using an Intent in any of Context.sendBroadcast(Intent intent), Context.sendOrderedBroadcast(), and Context.sendStickyBroadcast()
  • 21. @2011 Mihail L. Sichitiu 21 Shutting down components • Activities – Can terminate itself via finish(); – Can terminate other activities it started via finishActivity(); • Services – Can terminate via stopSelf(); or Context.stopService(); • Content Providers – Are only active when responding to ContentResolvers • Broadcast Receivers – Are only active when responding to broadcasts
  • 22. @2011 Mihail L. Sichitiu 22 Android Manifest • Its main purpose in life is to declare the components to the system: <?xml version="1.0" encoding="utf-8"?> <manifest . . . > <application . . . > <activity android:name="com.example.project.FreneticActivity" android:icon="@drawable/small_pic.png" android:label="@string/freneticLabel" . . . > </activity> . . . </application> </manifest>
  • 23. Manifest File (1) • Contains characteristics about your application • When have more than one Activity in app, NEED to specify it in manifest file – Go to graphical view of the manifest file – Add an Activity in the bottom right – Browse for the name of the activity • Need to specify Services and other components too • Also important to define permissions and external libraries, like Google Maps API
  • 24. Manifest File (2) – Adding an Activity
  • 25. @2011 Mihail L. Sichitiu 25 Intent Filters • Declare Intents handled by the current application (in the AndroidManifest): <?xml version="1.0" encoding="utf-8"?> <manifest . . . > <application . . . > <activity android:name="com.example.project.FreneticActivity" android:icon="@drawable/small_pic.png" android:label="@string/freneticLabel" . . . > <intent-filter . . . > <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter . . . > <action android:name="com.example.project.BOUNCE" /> <data android:mimeType="image/jpeg" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> . . . </application> </manifest> Shows in the Launcher and is the main activity to start Handles JPEG images in some way
  • 26.
  • 28. References • This tutorial is a brief overview of some major concepts…Android is much richer and more complex • Developer’s Guide – http://developer.android.com/guide/index.html • API Reference – http://developer.android.com/reference/packages.html
  • 29. Tools • Phone • Eclipse ( http://www.eclipse.org/downloads/ ) – Android Plugin (ADT) • Android SDK ( http://developer.android.com/sdk/index.html ) – Install everything except Additional SDK Platforms, unless you want to • Windows Users: may need to install Motorola Driver directly ( http://www.motorola.com/Support/US- EN/Support-Homepage/Software_and_Drivers/USB-and-PC-Charging- Drivers )
  • 30. Android SDK • Once installed open the SDK Manager • Install the desired packages • Create an Android Virtual Device (AVD)
  • 32. AVD
  • 33. ADT Plugin (1) • In Eclipse, go to Help -> Install New Software • Click ‘Add’ in top right • Enter: – Name: ADT Plugin – Location: https://dl-ssl.google.com/android/eclipse/ • Click OK, then select ‘Developer Tools’, click Next • Click Next and then Finish • Afterwards, restart Eclipse • Specify SDK location (next 3 slides) – Must do this every time start a new project in a new location (at least in Windows)
  • 38. Creating a Project (2) Need the items circled Then click Finish
  • 39. Project Components • src – your source code • gen – auto-generated code (usually just R.java) • Included libraries • Resources – Drawables (like .png images) – Layouts – Values (like strings) • Manifest file
  • 40. XML • Used to define some of the resources – Layouts (UI) – Strings • Manifest file • Shouldn’t usually have to edit it directly, Eclipse can do that for you • Preferred way of creating UIs – Separates the description of the layout from any actual code that controls it – Can easily take a UI from one platform to another
  • 41. R Class • Auto-generated: you shouldn’t edit it • Contains IDs of the project resources • Enforces good software engineering • Use findViewById and Resources object to get access to the resources – Ex. Button b = (Button)findViewById(R.id.button1) – Ex. getResources().getString(R.string.hello));
  • 42. Layouts (1) • Eclipse has a great UI creator – Generates the XML for you • Composed of View objects • Can be specified for portrait and landscape mode – Use same file name, so can make completely different UIs for the orientations without modifying any code
  • 44. Layouts (3) • Click ‘Create’ to make layout modifications • When in portrait mode can select ‘Portrait’ to make a res sub folder for portrait layouts – Likewise for Landscape layouts while in landscape mode – Will create folders titled ‘layout-port’ and ‘layout-land’ • Note: these ‘port’ and ‘land’ folders are examples of ‘alternate layouts’, see here for more info – http://developer.android.com/guide/topics/resources/providing-resources.html • Avoid errors by making sure components have the same id in both orientations, and that you’ve tested each orientation thoroughly
  • 46. Strings • In res/values – strings.xml • Application wide available strings • Promotes good software engineering • UI components made in the UI editor should have text defined in strings.xml • Strings are just one kind of ‘Value’ there are many others
  • 47. Android Programming Components • Activity – http://developer.android.com/guide/topics/fundamentals/activities.html • Service – http://developer.android.com/guide/topics/fundamentals/services.html • Content Providers • Broadcast Receivers • Android in a nutshell: – http://developer.android.com/guide/topics/fundamentals.html
  • 48. Activities (1) • The basis of android applications • A single Activity defines a single viewable screen – the actions, not the layout • Can have multiple per application • Each is a separate entity • They have a structured life cycle – Different events in their life happen either via the user touching buttons or programmatically
  • 50. Services (1) • Run in the background – Can continue even if Activity that started it dies – Should be used if something needs to be done while the user is not interacting with application • Otherwise, a thread is probably more applicable – Should create a new thread in the service to do work in, since the service runs in the main thread • Can be bound to an application – In which case will terminate when all applications bound to it unbind – Allows multiple applications to communicate with it via a common interface • Needs to be declared in manifest file • Like Activities, has a structured life cycle
  • 52. Running in Eclipse (1) • Similar to launching a regular Java app, use the launch configurations • Specify an Android Application and create a new one • Specify activity to be run • Can select a manual option, so each time program is run, you are asked whether you want to use the actual phone or the emulator – Otherwise, it should be smart and use whichever one is available
  • 56. Debugging • Instead of using traditional System.out.println, use the Log class – Imported with android.util.Log – Multiple types of output (debug, warning, error, …) – Log.d(<tag>,<string>) • Can be read using logcat. – Print out the whole log, which auto-updates • adb logcat – Erase log • adb logcat –c – Filter output via tags • adb logcat <tag>:<msg type> *:S • can have multiple <tag>:<msg type> filters • <msg type> corresponds to debug, warning, error, etc. • If use Log.d(), then <msg type> = D • Reference – http://developer.android.com/guide/developing/debugging/debugging-log.html
  • 57. UI With GUI Builder
  • 58. Android Event Handlers From the code file for the activity: Button ok = (Button) findViewById(R.id.button1); ok.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { CharSequence s = et.getText(); tv.setText("Welcome, " + s); } });
  • 59. Sams Teach Yourself Android™Application Development in 24 Hours (0321673352) Copyright ©2010 Lauren Darcey and Shane Conder FIGURE 3.2 Important callback methods of the activity life cycle.