Intro to Android Development Ben Lafreniere
Getting up and running Don’t use the VM! ials/hello-world.html ials/hello-world.html Steps: – Install Eclipse – Install the Android Development Tools (ADT) plugin – Install the Android SDK (may be optional) – Create an emulator – Hello world!
Download and Install Eclipse Eclipse has many versions! Go with Eclipse Classic (32- or 64-bit depending on your system)
Install ADT plugin adt.html#installing
Configure ADT plugin
Download and Install the Android SDK
Use SDK Manager to install APIs Why so many SDK versions? – Android is a UI toolkit being incrementally developed before our eyes Install and use Android SDK (API 10) – Because these are the phones we’ll be marking on
Video walkthrough anddev_installing.avi
Creating an emulator Not all developers have android devices – So we emulate one! Video – anddev_create_emu.avi
Developing with the Emulator Emulator takes a long time to boot up – Enabling the ‘Snapshot’ option speeds things up by saving the emulator’s state when it’s closed, and restoring it when it’s started again You can keep the emulator open between runs Don’t develop on the VM! (the emulator will run way too slow)
Android Programming
Creating an Android project world.html
Hello World! HelloAndroidActivity.java
Android App Anatomy – Classes Activity – A single screen of the application View – The superclass for widgets (the UI is made up of a tree of View objects) Intent – An action that must be performed
Activities A single, focused thing that the user can do Should use an Activity for each screen of the application Activities must be declared in the Manifest file
Views Superclass of all Android widgets (similar to java.awt.Component in Swing)
Views Superclass of all Android widgets (similar to the Component class from Swing)
Intents Abstract description of an action that the user wants to perform (e.g. open a webpage, share a picture) Used to transition between Activities Includes the intended action, and may include data
Code Examples HelloAndroid – One Activity, One TextView, very simple FormExample – Two Activities, using an Intent to start a second Activity DataPassExample – Builds on FormExample, using Intents to pass data between Activities
Much more Using XML layouts to separate presentation from logic Using strings.xml in lieu of hard-coded strings Saving the application’s state when an activity is paused
Useful references Android Developers Tutorials section torial torial Notebook tutorial (detailed multi-Activity example) dex.html dex.html Common tasks ml ml