Android Fundamentals. What is Android Software stack for mobile devices Software stack for mobile devices SDK provides tools and APIs to develop apps.

Slides:



Advertisements
Similar presentations
Android Application Development A Tutorial Driven Course.
Advertisements

Google Android Introduction to Mobile Computing. Android is part of the build a better phone process Open Handset Alliance produces Android Comprises.
Android UserInterfaces Nasrullah Niazi. overView All user interface elements in an Android app are built using View and ViewGroup objects. A View is an.
Introduction.  Professor  Adam Porter 
What is Android?.
Android architecture overview
Android Platform Overview (1)
Unlocking Android Chapter 4.  Understanding activities and views  Exploring the Activity lifecycle  Working with resources  Defining the AndroidManifest.xml.
App Development on Android
Filip Debelić What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,
1 CSCE 4013: Mobile Systems Programming Nilanjan Banerjee Mobile Systems Programming University of Arkansas Fayetteville, AR
Mobile Application Development
Google Android as a mobile development platform T Internet Technologies for Mobile Computing Olli Mäkinen.
By: Jeremy Smith.  Introduction  Droid Draw  Add XML file  Layouts  LinearLayout  RelativeLayout  Objects  Notifications  Toast  Status Bar.
Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department.
Android: Layouts David Meredith
Emerging Platform#4: Android Bina Ramamurthy.  Android is an Operating system.  Android is an emerging platform for mobile devices.  Initially developed.
Android Middleware Bo Pang
Mobile Application Development with ANDROID Tejas Lagvankar UMBC 29 April 2009.
About me Yichuan Wang Android Basics Credit goes to Google and UMBC.
Android: versions Note that: Honeycomb (Android v3.0) A tablet-only release Jelly Bean (Android v4.1) Released on July 09, 2012.
CS5103 Software Engineering Lecture 08 Android Development II.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
01. Introduction to Android Prof. Oum Saokosal Master of Engineering in Information Systems, South Korea
Tip Calculator App Building an Android App with Java © by Pearson Education, Inc. All Rights Reserved.
Android Layouts. Layouts Define the user interface for an activity Layouts are defined in.xml files – within /res/layout folder – different layout can.
Understanding Hello Android 1 CS300. Activity  Similar to a form  Base class for the visual, interactive components of your application  Android API.
This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit
DUE Hello World on the Android Platform.
CS378 - Mobile Computing Intents.
Frank Xu Gannon University.  Linear Layout  Relative Layout  Table Layout.
ANDROID 응용 프로그래밍 과정 – 목차 - 안드로이드란 - 안드로이드가 만들어지게 된배경 - 안드로이드의 철학 - 안드로이드 환경설정 ( SDK download, eclipse plug-in 설정, 간단한 프로그램 실행 ) - 안드로이드 동작원리 - 안드로이드 핵심.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
Overview of Android Application Development
CS378 - Mobile Computing Intents. Allow us to use applications and components that are part of Android System – start activities – start services – deliver.
Android Boot Camp for Developers Using Java, 3E
User Interfaces: Part 1 (View Groups and Layouts).
Application Development for mobile Devices
ANDROID BY:-AANCHAL MEHTA MNW-880-2K11. Introduction to Android Open software platform for mobile development A complete stack – OS, Middleware, Applications.
Created By. Jainik B Patel Prashant A Goswami Gujarat Vidyapith Computer Department Ahmedabad.
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
1 Android Introduction Platform Overview. 2 What is Android?  Android is a software stack for mobile devices that includes an operating system, middleware.
1 Android Development Lean and mean introduction Based on a presentation by Mihail L. Sichitiu.
CS378 - Mobile Computing User Interface Basics. User Interface Elements View – Control – ViewGroup Layout Widget (Compound Control) Many pre built Views.
Building User Interfaces Basic Applications
Chapter 2 Building User Interfaces and Basic Applications.
1 Android Workshop Platform Overview. 2 What is Android?  Android is a software stack for mobile devices that includes an operating system, middleware.
Android operating system N. Sravani M. Tech(CSE) (09251D5804)
By Adam Reimel. Outline Introduction Platform Architecture Future Conclusion.
CHAPTER 4 Fragments ActionBar Menus. Explore how to build applications that use an ActionBar and Fragments Understand the Fragment lifecycle Learn to.
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
Introduction to Android Programming
The Basics of Android App Development Sankarshan Mridha Satadal Sengupta.
Android Mobile Application Development
Android Application -Architecture.
Open Handset Alliance.
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
CMPE419 Mobile Application Development
CIS 470 Mobile App Development
CS5103 Software Engineering
Application Development A Tutorial Driven Course
Building User Interfaces Basic Applications
CIS 470 Mobile App Development
Korea Software HRD Center
Emerging Platform#3 Android & Programming an App
Introduction to Android
Mobile Programmming Dr. Mohsin Ali Memon.
CMPE419 Mobile Application Development
Android Sensor Programming
Presentation transcript:

Android Fundamentals

What is Android Software stack for mobile devices Software stack for mobile devices SDK provides tools and APIs to develop apps SDK provides tools and APIs to develop apps

Major Components Image source:

Applications Ships with core set of apps, written in Java Ships with core set of apps, written in Java Developers have access to core APIs Developers have access to core APIs Views used to build application Views used to build application Content providers – access data from other apps Content providers – access data from other apps Resource manager – access to local strings, graphics Resource manager – access to local strings, graphics Notification manager – display custom alerts Notification manager – display custom alerts Activity manager – manages app lifecycle Activity manager – manages app lifecycle

Libraries C/C++ C/C++ Media libraries – A/V, images Media libraries – A/V, images Surface manager – 2D/3D graphic layers Surface manager – 2D/3D graphic layers LibWebCore – web browser engine LibWebCore – web browser engine SGL – 2D graphics engine SGL – 2D graphics engine 3D – hardware or software acceleration 3D – hardware or software acceleration FreeType – BMP and vector fonts FreeType – BMP and vector fonts SQLite – database engine SQLite – database engine

Runtime and Kernel Includes core set of libraries Includes core set of libraries Provides most of core Java libraries Provides most of core Java libraries Each app runs in its own process Each app runs in its own process Own instance of the Dalvik Virtual Machine Own instance of the Dalvik Virtual Machine Linux 2.6 is used for core system services Linux 2.6 is used for core system services Abstraction layer between HW & SW stacks Abstraction layer between HW & SW stacks

Main Components of Android Activities Activities Services Services Content Providers Content Providers Broadcast Receivers Broadcast Receivers

Activity Single page user interface Single page user interface Most apps have multiple activities Most apps have multiple activities Callable from other apps (if you allow it) Callable from other apps (if you allow it)

Service No user interface No user interface Runs in background Runs in background Started and stopped by activities Started and stopped by activities

Content Provider Manages shared set of application data Manages shared set of application data Data may be shared between apps or be private Data may be shared between apps or be private Performs data handling functions Performs data handling functions

Broadcast Receiver Listens for system wide (intent) broadcasts Listens for system wide (intent) broadcasts Intent filter limits which intents cared about Intent filter limits which intents cared about Similar to an interrupt handler Similar to an interrupt handler Redirects to appropriate activity or service Redirects to appropriate activity or service

Intents Allows an activity, service or broadcast receiver to link to another Allows an activity, service or broadcast receiver to link to another Within or between apps Within or between apps Allows apps to use components of others Allows apps to use components of others Image source: Mednieks, Dornin, Meike, Nakamura. Programming Android

User Interfaces Images from Android Design

User Interface Basics Recall the basic unit of an Android application is an Activity Recall the basic unit of an Android application is an Activity An Activity displays the user interface An Activity displays the user interface User Interfaces are built from View and ViewGroup object instances of the View class User Interfaces are built from View and ViewGroup object instances of the View class View objects are data structures that store content and layout parameters View objects are data structures that store content and layout parameters controls a specific rectangular region of the screen controls a specific rectangular region of the screen responsible for drawing itself responsible for drawing itself handles events handles events Subclass “widgets” provide user interface objects: Subclass “widgets” provide user interface objects: text fields, buttons, labels text fields, buttons, labels serves as means of interaction with user serves as means of interaction with user Images from Android Design

View & ViewGroup ViewGroup objects act like containers for View objects ViewGroup objects act like containers for View objects one or more Views are grouped together one or more Views are grouped together Subclass “layouts” provide different layout architectures: Subclass “layouts” provide different layout architectures: LinearLayout – displays Views in linear direction either horizontally or vertically LinearLayout – displays Views in linear direction either horizontally or vertically default is horizontal default is horizontal text field, two radio buttons, and button text field, two radio buttons, and button in a vertical orientation RelativeLayout – displays Views in relative position to each other RelativeLayout – displays Views in relative position to each other an id needs to be assigned to elements for an id needs to be assigned to elements forreference text field, two radio buttons, and button text field, two radio buttons, and button in relative position Images from Android Basics & User Interfaces

ViewGroup Layout TableLayout – displays Views in table form with rows and columns TableLayout – displays Views in table form with rows and columns buttons for the calculator are in table form buttons for the calculator are in table form Some other layouts from base class android.view.ViewGroup: Some other layouts from base class android.view.ViewGroup: AbsoluteLayout AbsoluteLayout FrameLayout FrameLayout ScrollView ScrollView Image from Android Basics & User Interfaces

Common Attributes View and ViewGroup attributes: View and ViewGroup attributes: layout_width layout_width layout_height layout_height layout_margintop layout_margintop layout_marginbottom layout_marginbottom layout_marginleft layout_marginleft layout_marginright layout_marginright layout_x layout_x layout_y layout_y LinearLayout and TableLayout attributes: LinearLayout and TableLayout attributes: layout_gravity – specifies how child Views are positioned layout_gravity – specifies how child Views are positioned layout_weight – specifies how much space is to be allocated, total must equal 1 layout_weight – specifies how much space is to be allocated, total must equal 1 Images from Understanding User Interface In Android

View Hierarchy Parent nodes contain and organize layout of child nodes Parent nodes contain and organize layout of child nodes Child nodes are responsible for drawing themselves at the request of the parent Child nodes are responsible for drawing themselves at the request of the parent control and respond to user input contained within their region of the display control and respond to user input contained within their region of the display The Activity that displays a particular screen calls the setContentView() method to draw the screen defined by the hierarchy The Activity that displays a particular screen calls the setContentView() method to draw the screen defined by the hierarchy XML layout files typically used for defining layouts and expressing view hierarchies XML layout files typically used for defining layouts and expressing view hierarchies each element in XML is a View or ViewGroup object each element in XML is a View or ViewGroup object Image from Android Developers

Input Events Define to inform the system of user interaction Define to inform the system of user interaction Event listener is defined and registered with the View object Event listener is defined and registered with the View object View class has a collection of On Listener: View class has a collection of On Listener: View.OnClickListener View.OnClickListener View.OnTouchListener View.OnTouchListener View.OnKeyListener View.OnKeyListener Example: OnTouch, when the user touches a defined View object on the screen Example: OnTouch, when the user touches a defined View object on the screen define View.OnTouchListener define View.OnTouchListener register the View object with setOnTouchListener() register the View object with setOnTouchListener()

Application Menus Two types of menus Two types of menus Options menu – typically when an application is running Options menu – typically when an application is running accessed by pressing the MENU button on the device accessed by pressing the MENU button on the device Context menu – typically used for displaying specific information about an item Context menu – typically used for displaying specific information about an item accessed by pressing and hold down on an object accessed by pressing and hold down on an object Images from Android User Interfaces

Application Menus Options menus allow users quick access to an application’s functions, preferences and settings Options menus allow users quick access to an application’s functions, preferences and settings Structured using a View hierarchy Structured using a View hierarchy define onCreateOptionsMenu() define onCreateOptionsMenu() define onCreateContectMenu() define onCreateContectMenu() Handle their own events, no need to register event listeners Handle their own events, no need to register event listeners Selections handled by methods Selections handled by methods onOptionsItemSelected() onOptionsItemSelected() onContextItemSelected() onContextItemSelected() Items for menus can be declared in an XML file like an application layout Items for menus can be declared in an XML file like an application layout

Hardware Systems/Sensors Images from Z-DeviceTest app

Sensors public class SensorActivity extends Activity, implements SensorEventListener { … SensorManager mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE); Sensor mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); … mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL); public void onSensorChanged(SensorEvent event) { }…} Image from AndroSensor app

Sensor Constants public static final float GRAVITY_EARTH = public static final float GRAVITY_EARTH = public static final float LIGHT_FULLMOON = 0.25 public static final float LIGHT_FULLMOON = 0.25 public static final float MAGNETIC_FIELD_EARTH_MIN = 30.0 public static final float MAGNETIC_FIELD_EARTH_MIN = 30.0 public static final float PRESSURE_STANDARD_ATMOSPHERE = public static final float PRESSURE_STANDARD_ATMOSPHERE = public static final float GRAVITY_THE_ISLAND = public static final float GRAVITY_THE_ISLAND = public static final float GRAVITY_DEATH_STAR_I = E-7 public static final float GRAVITY_DEATH_STAR_I = E-7

Bluetooth BluetoothAdapter Local radio state Local radio state Discover devices Discover devicesBluetoothServerSocket Receives connection requests Receives connection requests Returns a BluetoothSocket when connected Returns a BluetoothSocket when connectedBluetoothSocket InputStream object InputStream object OutputStream object OutputStream object

Location LocationManager locman = (LocationManager) getSystemService(Context.LOCATION_SERVICE ) Location loc = locman.getLastKnownLocation(String provider) NETWORK_PROVIDER GPS_PROVIDER

Location Listener private class MyLocListener implements LocationListener onLocationChanged(Location location) onLocationChanged(Location location) ) requestLocationUpdates(long minTime, float minDistance, Criteria criteria, PendingIntent intent) public void addProximityAlert (double latitude, double longitude, float radius, long expiration, PendingIntent intent)

References en en en en Mednicks, Dornin, Meike, Nakamura, Programming Android Mednicks, Dornin, Meike, Nakamura, Programming Android asicsUI.html asicsUI.html asicsUI.html asicsUI.html Ableson, Sen, King, Ortiz: Android In Action – Third Edition Ableson, Sen, King, Ortiz: Android In Action – Third Edition