an introduction to android application development...programming c++ languages android android debug...
TRANSCRIPT
An Introduction to Android Application Development
Serdar Akın, Haluk Tüfekçi
ARDIC ARGE – http://www.ardictech.com
April 2011
Programming Languages
Android Software Development Kit (SDK)
Development Environment
Dalvik Cross Assembler
Integrated Development Environment
Java (Officially supported)
C (Android NDK
Needed)
Operating System
Class Library
C++ (Android NDK
Needed)
Android Debug Bridge (adb)
Dalvik Debug Monitor Service
(ddms)
Android Emulator
Documentation Sample Codes System Images
Computing System
Native Development
Kit (NDK)
USB Driver (OEM USB drivers may be installed)
Ubuntu
Galileo
Java Development
Tools
Java Development
Kit 5 or 6
Android Development Tools Plugin
Android Device
Android Development Environment
Environments
Process Man.
Memory Man.
Drivers, HAL
Security
Inter-process
Communication
Accessible
through JNI,
C/C++ Libraries,
UI, Graphics,
Media
Optimized
virtual machine,
Java Core
Libraries
Application Life
Cycle,
API,
Managers
Built-In
Applications
User
Applications
Eclipse
Android SDK
Hello,
World
APPLICATIONS
APPLICATION FRAMEWORK
ANDROID RUNTIME LIBRARIES
LINUX KERNEL
Display Driver
Keypad Driver WiFi Driver
Camera Driver Flash Memory
Driver
Audio Driver
Binder (IPC)
Driver
Power
Management
Java Core
Libraries
Dalvik Virtual
Machine
Surface
Manager
OpenGL|ES FreeType
Media
Framework SQLite
WebKit
SGL (2D
graphics) SSL bionic
Activity
Manager
Window
Manager
Content
Providers View Systems
Package
Manager
Telephony
Manager
Resource
Manager
Location
Manager Notification
Manager
Home Contacts Phone Browser …
Application Framework
Activity Manager Application lifecycle Navigation
View Manager Programmable controls List, Grid, Textbox, Button, Embedded web browser
Resource Manager Localized strings Graphics Layout files
Notification Manager Custom alerts for end user
Content Providers Access data Share data
Package Manager Application Installation
Window Manager Screen organization Surface allocation for applications
Hello, World
package com.google.android.HelloWorldActivity;
import android.app.Activity;
import android.os.Bundle;
public class HelloWorldActivity extends Activity {
public HelloWorldActivity() {
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.helloworld_activity);
}
}
Application Structures
Activity • A single, focused screen that the user can do
Intent • Intents are used for inter-communication among activities
or services • An intent is a data structure that stores a message
Broadcast Receiver
• A broadcast receiver triggers an intent to start an application
Service • Services run in the background for an indefinite period of
time • They have no user interface interaction
Content Provider
• A content provider is an interface to store and retrieve data and make it accessible to all applications
Resource • Externalization of strings and graphics
Application Lifecycle
Activity starts
onCreate()
onStart()
onResume()
onRestart()
onPause()
onDestroy()
onStop()
Activity is running
Activity is shut down
User navigates back to the activity
Process is killed
The activity comes to the foreground
The activity comes to the foreground
Other applications need memory
Another activity comes in front of the
activity
The activity is no longer visible
Views and Layouts
Parent Layout
Child Layout
Child Layout
Text Box
Button
Label
Child Layout
Text Box
Layouts
* Absolute Layout is deprecated
Linear Layout • Vertical • Horizontal
Relative Layout Table Layout Frame Layout
View Examples
GridView TabView MapView WebView
Key points In Android Application Development
Performance and battery life is important in mobile devices
Recycle java objects
Avoid floating point arithmetic
Use efficient data format and parser
Reduce transferred data size, gzip text data
Keep memory small in order not to be killed
Services
Do not use services as daemons
Start them with AlarmManager only when device is awake
Use receivers to awaken services
Check battery life and do not run heavy jobs if battery is critical
References
http://developer.android.com/guide/index.html
http://androidappdocs.appspot.com/index.html