My Android Presentation

Here is information from the slides from my presentation on Android that I gave at the Chicago Java Users Group on March 15, 2011. I think a lot of it is still valid.

The first slide was just the title.

2. The Clint Eastwood Slide

  • The Good: Gives Java a shot in the ARM (**rimshot**) and the iPhone some competition
  • The Bad: Fragmentation, 2 current releases, some people’s Reality Distortion Field is thicker than Kool Aid
  • The Ugly: Potential legal issues, huge API (1504 classes in SDK), kind of clunky (575 of those are nested classes, and you will make some inner classes)

3. Android & Java

  • It does not run Java, but you develop apps with Java
  • Your Java bytecode gets translated into bytecode the Dalvik Virtual Machine can run
  • Oracle’s Lawsuit: Big Mistake?

4. Anatomy of an App

  • You get an Activity class
  • /gen with R.java (created for you)
  • /res/drawable
  • /res/layout/main.xml (maps UI for the main Activity, usually made with a designer, other Activity classes get XML files as well)
  • /res/values/strings.xml (gives ID’s and aliases for some variables)
  • AndroidManifest.xml (what binds it all together)

5. Components

  • Activities
  • Services
  • Content Providers
  • Broadcast Receivers
  • Intents
  • Views

6. Activity

  • Class android.app.Activity
  • Each Activity represents a screen for the user
  • An app can have multiple Activities, and must have a main Activity
  • You must override the onCreate method

7. Services

  • Class android.app.Service
  • “A Service is an application component representing either an application’s desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use.”
  • Kind of what it sounds like: Runs in the background

8. ContentProvider

  • Class android.content.ContentProvider
  • Used to send data between apps
  • Data can be in files, RDBMS, or on a server
  • Class uses URIs to send data
  • Similar to REST

9. Broadcast Receiver

  • Class android.content.BroadcastReceiver
  • Used to receive messages sent via Intents

10. Intents

  • Class android.content.Intent
  • A class that other classes use to send messages to each other
  • Not to be confused with android.os.Message
  • Used by Activity classes, Services and BroadcastReceivers
  • Asynchronous, loosely-coupled

11. Intents II

  • Can be explicit (you specify what should respond to your Intent)
  • Or implicit (the system decides how to handle it)

Then I showed screenshots of the SDK installation and went through building a quick app.

At one point I said that there needs to be a translator between Android and English. Each screen is handled by a class that extends “Activity” (why can’t they call it screen?) and instead of sending messages to each other or making requests, you send an Intent.

Image from  Aurora Consurgens, a 15th century manuscript housed at Central Library of Zurich. Image from e-Codices. This image is assumed to be allowed under Fair Use.