Android for Java Developers
Framework Overview <ul><li>http://developer.android.com/guide/basics/what-is-android.html </li></ul>
Framework – Linux Kernel <ul><li>Core system services </li></ul><ul><li>Handles security, memory management, process manag...
Framework - Dalvik <ul><li>Virtual Machine </li></ul><ul><li>Optimized for mobile devices </li></ul><ul><li>Every app runs...
Framework - Libraries <ul><li>Variety of libraries to provide built in functionality. </li></ul>
Framework – Application Framework <ul><li>Provides functionality to allow Applications to interact with underlying OS and ...
Framework – Applications <ul><li>The layer where custom-built applications live. </li></ul><ul><li>This is the place where...
Framework Overview
Get Developer Tools <ul><li>SDK </li></ul><ul><ul><li>http://developer.android.com/sdk/index.html </li></ul></ul><ul><ul><...
Developer Tools (cont ) <ul><li>Android command </li></ul><ul><li>Emulator </li></ul><ul><ul><li>Android Virtual Devices (...
Developing an App <ul><li>Create a new project </li></ul><ul><ul><li>Project content overview </li></ul></ul><ul><li>Code ...
Terminology <ul><ul><li>Most Commonly used elements </li></ul></ul><ul><ul><ul><li>Activity </li></ul></ul></ul><ul><ul><u...
Terminology - Activity <ul><li>Activity – (Noun) A single screen, your application is made up of one or more of these. </l...
Terminology - Layout <ul><li>Layout – describes the UI of an activity  </li></ul><ul><ul><li>Enables separation of UI from...
Terminology - Intent <ul><li>Intent – (Verb) code to perform an action  </li></ul><ul><ul><li>Wiring between activities, s...
Terminology - Resources <ul><li>Resource  – text, pictures, sound, etc </li></ul><ul><ul><li>are all abstracted from the c...
Terminology - Manifest <ul><li>Manifest File – describes your app  </li></ul><ul><ul><li>always named AndroidManifest.xml ...
Terminology – cont. <ul><ul><li>Other important elements </li></ul></ul><ul><ul><ul><li>Widget </li></ul></ul></ul><ul><ul...
Learn More <ul><li>http://developer.android.com </li></ul><ul><li>Phoenix Android Users Group </li></ul><ul><ul><li>http:/...
Questions? <ul><li>Follow me on twitter: @mikewolfson </li></ul>
Upcoming SlideShare
Loading in...5
×

Android For Java Developers

7,099

Published on

Presentation given to the Phoenix Android Users Group; May 2010.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
7,099
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
70
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • http://developer.android.com/guide/basics/what-is-android.html Linux Kernel Android relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack. Runtime + Dalvik virtual machine VM optimized for mobile devices; Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included &amp;quot;dx&amp;quot; tool. The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management. By default, every application runs in its own Linux process. Android starts the process when any of the application&apos;s code needs to be executed, and shuts down the process when it&apos;s no longer needed and system resources are required by other applications. Each process has its own Java virtual machine (VM), so application code runs in isolation from the code of all other applications. By default, each application is assigned a unique Linux user ID. Permissions are set so that the application&apos;s files are visible only that user, only to the application itself — although there are ways to export them to other applications as well. Native Libraries Open GL – custom 2D lib; 3D graphics are based on OpenGL ES 1.0 specification SQLite for structured data storage Integrated browser based on the open source WebKit engine Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF) Camera, GPS, compass, and accelerometer (hardware dependent) Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE Application Framework: Activity Manager – Resource Manager – Location Manager – Notification Manager – Content Provider - Applications
  • http://developer.android.com/guide/basics/what-is-android.html Linux Kernel Android relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack.
  • http://developer.android.com/guide/basics/what-is-android.html Runtime + Dalvik virtual machine VM optimized for mobile devices; Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) - generated by included “dx tool”. .dex format which is optimized for minimal memory footprint. The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management. By default, every application runs in its own Linux process. Android starts the process when any of the application&apos;s code needs to be executed, and shuts down the process when it&apos;s no longer needed and system resources are required by other applications. Each process has its own Java virtual machine (VM), so application code runs in isolation from the code of all other applications. By default, each application is assigned a unique Linux user ID. Permissions are set so that the application&apos;s files are visible only that user, only to the application itself — although there are ways to export them to other applications as well.
  • Native Libraries Open GL – custom 2D lib; 3D graphics are based on OpenGL ES 1.0 specification SQLite for structured data storage Integrated browser based on the open source WebKit engine Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF) Camera, GPS, compass, and accelerometer (hardware dependent) Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE
  • Application Framework: A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data A Resource Manager , providing access to non-code resources such as localized strings, graphics, and layout files A Notification Manager that enables all applications to display custom alerts in the status bar An Activity Manager that manages the lifecycle of applications and provides a common navigation backstack
  • Applications
  • http://developer.android.com/guide/basics/what-is-android.html Linux Kernel Android relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack. Runtime + Dalvik virtual machine VM optimized for mobile devices; Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included &amp;quot;dx&amp;quot; tool. The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management. By default, every application runs in its own Linux process. Android starts the process when any of the application&apos;s code needs to be executed, and shuts down the process when it&apos;s no longer needed and system resources are required by other applications. Each process has its own Java virtual machine (VM), so application code runs in isolation from the code of all other applications. By default, each application is assigned a unique Linux user ID. Permissions are set so that the application&apos;s files are visible only that user, only to the application itself — although there are ways to export them to other applications as well. Native Libraries Open GL – custom 2D lib; 3D graphics are based on OpenGL ES 1.0 specification SQLite for structured data storage Integrated browser based on the open source WebKit engine Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF) Camera, GPS, compass, and accelerometer (hardware dependent) Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE Application Framework: Activity Manager – Resource Manager – Location Manager – Notification Manager – Content Provider - Applications
  • Other Tools: android To create/update Android projects and to create/move/delete AVDs. Android Emulator To run your Android applications on an emulated Android platform. Android Debug Bridge To interface with your emulator or connected device (install apps, shell the device, issue commands, etc.).
  • Android (android.bat) – command line tool to allow developer to manage SDK and AVDs Emulator (Mobile device emulator) -- a virtual mobile device that runs on your computer. The emulator lets you prototype, develop, and test Android applications without using a physical device. Each AVD is made up of: A hardware profile.  You can set options to define the hardware features of the virtual device. For example, you can define whether the device has a camera, whether it uses a physical QWERTY keyboard or a dialing pad, how much memory it has, and so on. A mapping to a system image.  You can define what version of the Android platform will run on the virtual device. You can choose a version of the standard Android platform or the system image packaged with an SDK add-on. Other options.  You can specify the emulator skin you want to use with the AVD, which lets you control the screen dimensions, appearance , and so on. You can also specify the emulated SD card to use with the AVD. A dedicated storage area on your development machine, in which is stored the device&apos;s user data (installed applications, settings, and so on) and emulated SD card. ADB: Android Debug Bridge (adb) is a versatile tool lets you manage the state of an emulator instance or Android-powered device. It is a client-server program that includes three components: A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create adb clients. A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device. A daemon, which runs as a background process on each emulator or device instance. DDMS: Includes: file explorer; Memory/Thread inspector (dumpsys, dumpstate); tools to execute Garbage Collection; Screen capture;
  • http://developer.android.com/resources/tutorials/hello-world.html Steps to create a new project. Once you complete the New Project Wizard, ADT creates the following folders and files in your new project: src/ Includes your stub Activity Java file. All other Java files for your application go here. &lt;Android Version&gt; / (e.g., Android 1.1/) Includes the android.jar file that your application will build against. This is determined by the build target that you have chosen in the New Project Wizard . gen/ This contains the Java files generated by ADT, such as your R.java file and interfaces created from AIDL files. assets/ This is empty. You can use it to store raw asset files. See Resources and Assets . res/ A folder for your application resources, such as drawable files, layout files, string values, etc. See Resources and Assets . AndroidManifest.xml The Android Manifest for your project. See The AndroidManifest.xml File . default.properties This file contains project settings, such as the build target. This files is integral to the project, as such, it should be maintained in a Source Revision Control system. It should never be edited manually — to edit project properties, right-click the project folder and select &amp;quot;Properties&amp;quot;.
  • Activity – (Noun) A single screen, your application is made up of one or more of these Intent – (Verb) code to perform an action – used to call an activity, service or broadcast receiver; this is the wiring between activities; Intent messaging is a facility for late run-time binding between components in the same or different applications Resource – text, pictures, sound, etc; These things are all abstracted from the code, and compiled into a class called R.class Manifest File – always named AndroidManifest.xml – bundled into .apk file (that contains the applications code, files, and resources), declares the components of an application, describes security permissions required by the app, and lists required library dependancies. Widget – miniature application views that can be embedded in other applications (such as the home screen), and receive periodic updates Service – a task that can be running, but is not visible (background apps FTW!) Broadcast Receiver – a component that does nothing but receive and react to broadcast announcements. These don’t contain a UI, but could be used to start an activity when an event triggers it. Ex. Listed for timezone, or low battery warnings. Security and Permissions - A central design point of the Android security architecture is that no application, by default, has permission to perform any operations that would adversely impact other applications, the operating system, or the user. Android is a multi-process system, in which each application (and parts of the system) runs in its own process. Most security between applications and the system is enforced at the process level through standard Linux facilities, such as user and group IDs that are assigned to applications. Additional finer-grained security features are provided through a &amp;quot;permission&amp;quot; mechanism that enforces restrictions on the specific operations that a particular process can perform, and per-URI permissions for granting ad-hoc access to specific pieces of data. A basic Android application has no permissions associated with it, meaning it can not do anything that would adversely impact the user experience or any data on the device. To make use of protected features of the device, you must include in your AndroidManifest.xml one or more &lt;uses-permission&gt; tags declaring the permissions that your application needs. Content Provider – Functionality designed to allow data to be shared across applications. It is data and an API that any app can access; Android uses this feature to provide contact info; they can be accessed through the android.provider package (some require permissions to access)
  • Activity – (Noun) A single screen, your application is made up of one or more of these
  • LinearLayout – arranges children in a single row/column. FrameLayout – arranges children so they show up at the top left. Commonly used for Activities with a single element, or tabbed views RelativeLayout – elements are arranges in relation to each other. (Element X is above Y). TableLayout – elements arranged in cells (like HTML tables)
  • Intent – (Verb) code to perform an action – used to call an activity, service or broadcast receiver; this is the wiring between activities; Intent messaging is a facility for late run-time binding between components in the same or different applications
  • Resource – text, pictures, sound, etc; These things are all abstracted from the code, and compiled into a class called R.class
  • Manifest File – always named AndroidManifest.xml – bundled into .apk file (that contains the applications code, files, and resources), declares the components of an application, describes security permissions required by the app, and lists required library dependancies.
  • Widget – miniature application views that can be embedded in other applications (such as the home screen), and receive periodic updates Service – a task that can be running, but is not visible (background apps FTW!) Broadcast Receiver – a component that does nothing but receive and react to broadcast announcements. These don’t contain a UI, but could be used to start an activity when an event triggers it. Ex. Listed for timezone, or low battery warnings. Security and Permissions - A central design point of the Android security architecture is that no application, by default, has permission to perform any operations that would adversely impact other applications, the operating system, or the user. Android is a multi-process system, in which each application (and parts of the system) runs in its own process. Most security between applications and the system is enforced at the process level through standard Linux facilities, such as user and group IDs that are assigned to applications. Additional finer-grained security features are provided through a &amp;quot;permission&amp;quot; mechanism that enforces restrictions on the specific operations that a particular process can perform, and per-URI permissions for granting ad-hoc access to specific pieces of data. A basic Android application has no permissions associated with it, meaning it can not do anything that would adversely impact the user experience or any data on the device. To make use of protected features of the device, you must include in your AndroidManifest.xml one or more &lt;uses-permission&gt; tags declaring the permissions that your application needs. Content Provider – Functionality designed to allow data to be shared across applications. It is data and an API that any app can access; Android uses this feature to provide contact info; they can be accessed through the android.provider package (some require permissions to access)
  • Transcript of "Android For Java Developers"

    1. 1. Android for Java Developers
    2. 2. Framework Overview <ul><li>http://developer.android.com/guide/basics/what-is-android.html </li></ul>
    3. 3. Framework – Linux Kernel <ul><li>Core system services </li></ul><ul><li>Handles security, memory management, process management, network access, etc </li></ul><ul><li>Abstraction layer between OS and hardware </li></ul>
    4. 4. Framework - Dalvik <ul><li>Virtual Machine </li></ul><ul><li>Optimized for mobile devices </li></ul><ul><li>Every app runs in its own instance of VM </li></ul><ul><li>Runs classes compiled by Java, and transformed into .dex files </li></ul>
    5. 5. Framework - Libraries <ul><li>Variety of libraries to provide built in functionality. </li></ul>
    6. 6. Framework – Application Framework <ul><li>Provides functionality to allow Applications to interact with underlying OS and other applications </li></ul><ul><li>Designed to simplify the reuse of components, and allow applications to publish, or make use of the capabilities of other applications </li></ul>
    7. 7. Framework – Applications <ul><li>The layer where custom-built applications live. </li></ul><ul><li>This is the place where most mobile developers will interact with Android. Your App Here! </li></ul>
    8. 8. Framework Overview
    9. 9. Get Developer Tools <ul><li>SDK </li></ul><ul><ul><li>http://developer.android.com/sdk/index.html </li></ul></ul><ul><ul><li>Requires Java SDK (5.0 +) </li></ul></ul><ul><ul><li>Updating versions </li></ul></ul><ul><ul><li>What the different versions mean </li></ul></ul><ul><li>ADT Plugin (for Eclipse) </li></ul><ul><ul><li>http://developer.android.com/guide/developing/tools/adt.html </li></ul></ul><ul><ul><li>Need Eclipse Ganymede (3.4+) </li></ul></ul><ul><ul><li>Update site: https://dl-ssl.google.com/android/eclipse </li></ul></ul><ul><li>Can develop without Eclipse </li></ul>
    10. 10. Developer Tools (cont ) <ul><li>Android command </li></ul><ul><li>Emulator </li></ul><ul><ul><li>Android Virtual Devices (AVD) </li></ul></ul><ul><li>Android Debug Bridge (ADB) </li></ul><ul><ul><li>Command line tool for interacting with phone/emulator. </li></ul></ul><ul><li>Dalvik Debug Monitor Server (DDMS) </li></ul><ul><ul><li>Debugging tool providing: screen capture, memory info, logging, info spoofing) </li></ul></ul><ul><li>http://developer.android.com/guide/developing/tools/index.html </li></ul>
    11. 11. Developing an App <ul><li>Create a new project </li></ul><ul><ul><li>Project content overview </li></ul></ul><ul><li>Code </li></ul><ul><li>Test on emulator (or device) </li></ul><ul><li>Debug </li></ul><ul><li>Sign </li></ul><ul><li>Export to device </li></ul><ul><ul><li>As APK ( A ndroid P ac K age file) </li></ul></ul>
    12. 12. Terminology <ul><ul><li>Most Commonly used elements </li></ul></ul><ul><ul><ul><li>Activity </li></ul></ul></ul><ul><ul><ul><li>Intent </li></ul></ul></ul><ul><ul><ul><li>Manifest file </li></ul></ul></ul><ul><ul><ul><li>Resources and Assets </li></ul></ul></ul><ul><ul><ul><li>Layout </li></ul></ul></ul>
    13. 13. Terminology - Activity <ul><li>Activity – (Noun) A single screen, your application is made up of one or more of these. </li></ul><ul><ul><li>Always extends Activity </li></ul></ul>
    14. 14. Terminology - Layout <ul><li>Layout – describes the UI of an activity </li></ul><ul><ul><li>Enables separation of UI from logic </li></ul></ul><ul><ul><li>There are a variety of layouts you can use including: Linear, Table, Relative, and Frame </li></ul></ul>
    15. 15. Terminology - Intent <ul><li>Intent – (Verb) code to perform an action </li></ul><ul><ul><li>Wiring between activities, services, broadcast receivers, or other functions </li></ul></ul><ul><ul><li>facility for late run-time binding between components in the same or different applications </li></ul></ul>
    16. 16. Terminology - Resources <ul><li>Resource – text, pictures, sound, etc </li></ul><ul><ul><li>are all abstracted from the code and logic </li></ul></ul><ul><ul><li>compiled and managed by system generated R.class file </li></ul></ul><ul><ul><li>Instantiate by getting reference to object </li></ul></ul>
    17. 17. Terminology - Manifest <ul><li>Manifest File – describes your app </li></ul><ul><ul><li>always named AndroidManifest.xml </li></ul></ul><ul><ul><li>declares the components of an application, describes security permissions required by the app, and lists required library dependencies </li></ul></ul>
    18. 18. Terminology – cont. <ul><ul><li>Other important elements </li></ul></ul><ul><ul><ul><li>Widget </li></ul></ul></ul><ul><ul><ul><li>Service </li></ul></ul></ul><ul><ul><ul><li>Broadcast Receiver </li></ul></ul></ul><ul><ul><ul><li>Security and Permission </li></ul></ul></ul><ul><ul><ul><li>Content Provider </li></ul></ul></ul>
    19. 19. Learn More <ul><li>http://developer.android.com </li></ul><ul><li>Phoenix Android Users Group </li></ul><ul><ul><li>http://groups.google.com/group/phoenix-android </li></ul></ul><ul><li>http://forum.xda-developers.com </li></ul><ul><li>http://www.openintents.org </li></ul><ul><li>http://www.anddev.org </li></ul><ul><li>Google Groups (Forums) </li></ul>
    20. 20. Questions? <ul><li>Follow me on twitter: @mikewolfson </li></ul>
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×