Vous êtes sur la page 1sur 31

Developing

Developing

Developing

Developing

Developing
JDK Eclipse - Classic version is recommended

Android SDK
ADT Plugin for Eclipse Subclipse(support for Subversion)

Developing
SDK Manager(AT LEAST ONE PLATFORM!)
Get projects from SVN Add Virtual Devices Set up Hardware Devices(Google USB driver)

Developing

Application Fundamentals
multi-user Linux system in which each application is a different user. Unique: ID(system), permissions, VM, process.

Code

Data & Resources

.apk

Application Project
Components

Properties

Libraries

Manifest

Resources

Application Project
Components

Properties

Libraries

Manifest

Resources

Application Components
Activities
UI Life Cycle Back Stack Long Running Dont provide UI SAME thread, SAME process

Services Content Providers


Broadcast Receiver

Store and retrieve data Only way to share data between apps

Receive intents High priority

Application Components
Activities
UI Life Cycle Back Stack Long Running Dont provide UI SAME thread, SAME process

Services Content Providers


Broadcast Receiver

Store and retrieve data Only way to share data between apps

Receive intents High priority

Activities - UI
Hierarchy of Views
Widgets & Layouts XML layout file & activity code Input events

Activities Tasks and Back Stacks


Task: collection of activities that users interact with when performing a certain job. Back Stack

Activities Life Cycle

Intents
Abstract description of an operation to be performed. startActivity to launch an Activity, broadcastIntent to send it to BroadcastReceiver components startService(Intent) or bindService(Intent, ServiceConnection, int) to start or communicate with a background Service.

Process and Threads


Process: all components of the same application run in the same process(you can change this in the manifest file).
Threads: main thread: UI thread The system DOES NOT create a separate thread for each instance of a component.

Process and Threads


two rules to Android's single thread model:

1. Do not block the UI thread 2. Do not access the Android UI toolkit from outside the UI thread

Data Storage
Shared Preferences Internal Storage External Storage SQLite Databases Network Connection
Private primitive data Key-value pairs
Private data Device memory Public data Shared storage

Structured data Private Database

Store and retrieve data using network operations

Manifest File
It names the Java package for the application It describes the components of the application It determines which processes will host application components. It declares the application permissions. It declares the minimum level of the Android API that the application requires. It lists the libraries that the application must be linked against.

Developing

Eclipse
Perspectives:
o Team Sync.: add, synchronize, commit

o Debug: stop, disconnect, show view expressions

o DDMS: advanced debugging controls

Remember
Keep develop environments updated!
Caution when commiting /bin directories Name the main packages properly: com.mecomo.<app name> , the package name serves as a unique identifier for the application. Stack Overflow RULES!

TIPS - PROBLEMS
Compiling problems: resource files, imports.
Running problems: manifest file, project properties. Unbelivable problems: disconnect device, uninstall app manually, restart eclipse, clean/build project -> PROBLEM SOLVED!

TIPS - SHORTCUTS
CTRL + M = toggle focus on main screen CTRL + 7 = toggle comments in selected text CTRL + SPACE = suggestions CTRL + SHIFT + / or * = retracts/expands code CTRL + SHIFT + F = auto-ident code ALT + SHIFT + Z = templates ALT + SHIFT + R = rename(refactor)

Links
http://developer.android.com/sdk/installing.ht ml http://developer.android.com/sdk/win-usb.html http://developer.android.com/videos/index.ht ml#v=fL6gSd4ugSI life cycle video http://developer.android.com/guide/index.htm l http://android-developers.blogspot.com/ http://stackoverflow.com/questions/tagged/an droid

Vous aimerez peut-être aussi