Download Java Coding in Eclipse

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
1
Android architecture overview
CS300
Android
2


A software stack for mobile devices developed and
managed by Open Handset Alliance
Free software under Apache License
Android
Key Applications
Middleware
Operating System (Linux Kernel 2.6)
CS300
OHA (Open Handset Alliance)
3

A business alliance consisting of 47 companies to
develop open standards for mobile devices
CS300
Android Software Stack
4
CS300
Android Software Stack– Linux Kernel
5


Relying on Linux Kernel 2.6 for core system services

Memory and Process Management

Network Stack

Driver Model

Security
Providing an abstraction layer between the hardware and the rest of
the software stack
CS300
Android Software Stack- Runtime
6

Core Libraries


Providing most of the functionality available in the core
libraries of the Java language
APIs




CS300

Data Structures
Utilities
File Access
Network Access
Graphics
Etc
7
Android Software Stack – Runtime
(Cont)

Dalvik Virtual Machine

Providing environment on which every Android
application runs
 Each
Android application runs in its own process, with its own
instance of the Dalvik VM.
 Dalvik has been written so that a device can run multiple
VMs efficiently.

CS300
Register-based virtual machine
8
Android Software Stack – Runtime
(Cont)

Dalvik Virtual Machine (Cont)

Executing the Dalvik Executable (.dex) format
 .dex
format is optimized for minimal memory footprint.
 Compilation

Relying on the Linux Kernel for:
 Threading
 Low-level
CS300
memory management
Android Software Stack - Libraries
9


Including a set of C/C++ libraries used by
components of the Android system
Exposed to developers through the Android
application framework
CS300
Android Software Stack – App
Framework
10

Enabling and simplifying the reuse of components
Developers have full access to the same framework APIs
used by the core applications.
 Users are allowed to replace components.

CS300
11
Android Software Stack – App
Framework (Cont)

Features
Feature
Role
View
System
Used to build an application, including lists, grids, text
boxes, buttons, and embedded web browser
Content
Provider
Enabling applications to access data from other
applications or to share their own data
Resource
Manager
Providing access to non-code resources (localized string, graphics,
and layout files)
Notification
Manager
Activity
Manager
CS300
Enabling all applications to display customer alerts in the
status bar
Managing the lifecycle of applications and providing
a common navigation backstack
12
Android Software Stack Application

Android provides a set of core applications:
Email Client
 SMS Program
 Calendar
 Maps
 Browser
 Contacts
CS300
 Etc.

Reference
13

North Carolina State University: Android Real Time
Systems,
http://code.google.com/edu/submissions/ncsu-rts/
CS300
14
Your first Android app
Hello Android!
CS300
Types of Android apps
15




Foreground: application that is effectively
suspended when it is not visible
Background: spends most of its lifetime hidden
Intermittent: some interactivity, but most work done
on background
Widget: home screen app
CS300
Understanding: Hello Android
16

Activity: base class for visual, interactive
components of your app
Code for activity
package org.example.helloAndroid;
import android.app.Activity;
import android.os.Bundle;
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}
CS300
Understanding: Hello Android
17

View: visual components, visual interface
Code for activity
package org.example.helloAndroid;
import android.app.Activity;
import android.os.Bundle;
CS300
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Understanding: Hello Android
18

Resources: stored in res
 Drawable,
 layout,
 values
CS300
and