You are on page 1of 23

Android 101

hosted by osl@b

Nikos Maroulis!
Mobile developer @Bugsense.com System architech @Odesk.com

What is android ?

In 2005 Google purchased Android Inc. In 2007 Google release the first version of android and founding the Open Handset Alliance with more than 84 companies take part on it. Android now have more than 300k app. Android now owns more than 51% of the market!

Android Versions
Android 1.0 Released on 23 Sem 2008 Only 1 device Htc dream supported Android 1.1 On Feb 2009 Google released this update! Android 1.5(CupCake) 30 April 2009 Widget support added Third part keyboard Animated screen transition

Android Versions
Android 1.6(Donut) Released in Sem 2009 WVGA screen support new gestures speed improvements Android 2.0/2.1(eclair) 2.1 released in Jan 2010 Multi touch events Numerous new camera features, including flash support, digital zoom, scene mode, white balance, color effect and macro focus

Android Versions
Android 2.2.X (Froyo)a
Speed, memory, and performance optimizations[28] Additional application speed improvements, implemented through JIT compilation[29] Integration of Chrome's V8 JavaScript engine into the Browser application Support for the Android Cloud to Device Messaging (C2DM) service, enabling push notifications Improved Microsoft Exchange support, including security policies, auto-discovery, GAL look-up, calendar synchronization and remote wipe Improved application launcher with shortcuts to Phone and Browser applications USB tethering and Wi-Fi hotspot functionality Added an option to disable data access over mobile network Updated Market application with batch and automatic update features[28] Quick switching between multiple keyboard languages and their dictionaries Voice dialing and contact sharing over Bluetooth Support for numeric and alphanumeric passwords Support for file upload fields in the Browser application[30] Support for installing applications to the expandable memory Adobe Flash support[31] Support for extra-high-PPI screens (320 ppi), such as 4" 720p[32]

Android Versions
On 6 December 2010, the Android 2.3 (Gingerbread) SDK was released, based on Linux kernel 2.6.35. [35][36]Changes included:[35] Updated user interface design with increased simplicity and speed Support for extra-large screen sizes and resolutions (WXGAand higher)[32] Native support forSIPVoIPinternet telephony Faster, more intuitive text input in virtual keyboard, with improved accuracy, better suggested text and voice input mode Enhancedcopy/pastefunctionality, allowing users to select a word by press-hold, copy, and paste Support forNear Field Communication(NFC), allowing the user read an NFC tag embedded in a poster, sticker, or advertisement New audio effects such as reverb, equalization, headphone virtualization, and bass boost NewDownload Manager, giving users easy access to any file downloaded from the browser, email, or another application Support for multiple cameras on the device, including a front-facing camera, if available Support forWebM/VP8 video playback, andAACaudio encoding Improvedpower managementwith a more active role in managing apps that are keeping the device awake for too long Enhanced support for native code development Switched fromYAFFStoext4on newer devices[37][38] Audio, graphical, and input enhancements for game developers Concurrentgarbage collectionfor increased performance Native support for more sensors (such asgyroscopesandbarometers) [edit]

Android 4.0
Virtual buttons in the UI, in place of capacitive or physical buttons Separation of widgets in a new tab, listed in a similar list to apps Improved visual voicemail with the ability to speed up or slow down voicemail messages Pinch-to-zoom functionality in the calendar Offline search, a two-line preview, and new action bar at the bottom of the Gmail app Ability to swipe left or right to switch between Gmail conversations Integrated screenshot capture (accomplished by holding down the Power and Volume-Down buttons) Improved error correction on the keyboard Ability to access apps directly from lock screen (similar to the HTC Sense 3.x) Improved copy and paste functionality Better voice integration and continuous, real-time speech to text dictation Face Unlock, a feature that allows users to unlock handsets using facial recognition software Automatic syncing of browser with users' Chrome bookmarks Data Usage section in settings that lets users set warnings when they approach a certain usage limit, and disable data when the limit is exceeded Ability to shut down apps that are using data in the background Improved camera app with zero shutter lag, time lapse settings, panorama mode, and the ability to zoom while recording Built-in photo editor Refreshed 'People' app with social network integration, status updates and hi-res images Android Beam, a NFC feature that lets user exchange web bookmarks, contact info, directions, YouTube, etc. Hardware acceleration of the UI Wi-Fi Direct 1080p video recording for stock Android devices

Android stack
Android kernel is a fork from linux kernel Android dosen't support the full set of stadar GNU libs nor X-windows system so we cant port easily apps from linux to android Android apps running on application framework which includes java stadar libs based on Apache Harmony Android jvm called Dalvik witch suppert JIT(Just in time compilation to run the java bytecode

Android Developing
What i am going need ? 1. Eclipse 2. Android sdk 3. Android eclipse plug in 4. Java lang experience Instuctions in android dev site http://developer.android.com/sdk/index.html

Android Activities

Android app = One or more activities One must be the launching activity

Activity Lifecycle

Activity Lifecycle (code view)


public class ExampleActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // The activity is being created. } @Override protected void onStart() { super.onStart(); // The activity is about to become visible. } @Override protected void onResume() { super.onResume(); // The activity has become visible (it is now "resumed"). } @Override protected void onPause() { super.onPause(); // Another activity is taking focus (this activity is about to be "paused"). } @Override protected void onStop() { super.onStop(); // The activity is no longer visible (it is now "stopped") }

Android Manifest!
It names the Java package for the application. The package name serves as a unique identifier for the application. It describes the components of the application the activities, services, broadcast receivers, and content providers that the application is composed of. It names the classes that implement each of the components and publishes their capabilities (for example, which Intent messages they can handle). These declarations let the Android system know what the components are and under what conditions they can be launched. It determines which processes will host application components. It declares which permissions the application must have in order to access protected parts of the API and interact with other applications. It also declares the permissions that others are required to have in order to interact with the application's components. It lists the Instrumentation classes that provide profiling and other information as the application is running. These declarations are present in the manifest only while the application is being developed and tested; they're removed before the application is published. It declares the minimum level of the Android API that the application requires. It lists the libraries that the application must be linked against.

Android Manifest
<?xml version="1.0" encoding="utf-8"?> <manifest> <uses-permission /> <permission /> <uses-sdk /> <supports-screens /> <application>

<activity> <intent-filter> <action /> <category /> <data /> </intent-filter> </activity> <uses-library /> </application>

Processes and Threads


Two simple rules: 1. Never block the UI thread 2. Do not access the Android UI toolkit from outside the UI thread.

Ok ready for our first app ?


Our first application. package com.example.helloandroid; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Hello, Android"); setContentView(tv); } }

Android UI - View
You can define UI from both java code and xml layout. Google suggest to use xml layout definition for UI The most common layout are relative and linear But how i can control ui elements that i have define in xml from java ?

Android UI
Java code TextView tv = (TextView)findViewById(R.id.textview); tv.setText("Hello World"); Xml definition <TextView android:id="@+id/textview" android:layout_width="fill_parent" android:layout_height="wrap_content" />

A more "complex" example (ListView)


We want a list with names at user screen We want on click item to popup the name.

Any ideas?

Android Debugging
What i can do if something going wrong ?

Thank you!!

email: nik.maroulis@gmail.com twitter: @nikos_maroulis

You might also like