Slide 1

Slide 1 text

github.com/alphonzo79/HelloAndroidExample

Slide 2

Slide 2 text

Course Goals o Know the tools needed for Android development o Basic understanding of what makes up an Android application o Basic understanding of using and modifying elements at run time. o Basic understanding of navigating around an app o Have a feeling for what questions to ask when you get into the thick of it

Slide 3

Slide 3 text

What we will NOT Cover o Setting up your IDE and creating the project o IntelliJ IDEA (Community Edition), Android Studio, Eclipse, etc (USE ANDROID STUDIO) o Most IDEs have a good wizard for creating the project and this is really quite simple. o Plenty of online tutorials. o Downloading and installing the JAVA JDK o Any recent version of Java SE (<1.8) will do o Downloading and installing the Android SDK

Slide 4

Slide 4 text

Setting Up Android (Quickly) o Make sure your environment variables are set up o $ANDROID_HOME:/sdk o Make sure your PATH includes o $ANDROID_HOME o $ANDROID_HOME/platform-tools o $ANDROID_HOME/tools o $ANDROID_HOME/bin o Install necessary API level(s) o From the command line run $ android sdk o Or launch from your IDE

Slide 5

Slide 5 text

Setting Up Android (Quickly) o Set up an emulator o From the command line run $ android avd o Or launch from your IDE o USE GENYMOTION – Mac and Linux require Oracle VirtualBox to be installed first o Attach your USB phone o Turn on Developer Options in settings o There may be a trick for your phone, check Google (click build number 7 times) o Enable USB Debugging, accept certificate warnings o Double check – run $ adb devices

Slide 6

Slide 6 text

Setting Up Android (Quickly) o Set up Gradle (If you want) o Current version is 2.+ o Add /bin to your $PATH o Or, AndroidStudio takes care of it for you

Slide 7

Slide 7 text

Project Structure and Basic Components o Activities (And Fragments) o We will see plenty of these. Just a mention for now o We may or may not touch on Fragments, depending on time o Services o Long-Running (it's a relative term) background tasks o Should always be run on their own threads o You need to put them on their own thread

Slide 8

Slide 8 text

Project Structure and Basic Components (Continued) o Broadcast Receivers o Register with Android to be notified of certain events and to receive certain intents o Content Providers o Means for sharing data between processes o Intents o Not necessarily a component, but very integral to all of them and how they are launched o We will see several of these

Slide 9

Slide 9 text

Project Structure and Basic Components (Continued) o Resources o Drawables, Layouts, Values (Strings, Colors, etc). o Allows us to provide a variety of alternate resources outside of code o Directory modifiers o Android Manifest o SDK data (min, max, target), Permission data, Application data, Launcher data, etc o A lot of this has since been moved into build.gradle

Slide 10

Slide 10 text

Project Structure and Basic Components (Continued) o Android Manifest (Continued) o All activities, services, and other components o If it's not in the manifest it doesn't exist o Gradle o settings.gradle o Manage project structure (included modules) o build.gradle (top level) o Manage project-wide build. This often just declares the Maven central repository and the classpath for the Android gradle plugin

Slide 11

Slide 11 text

Project Structure and Basic Components (Continued) o Gradle (Continued) o build.gradle (Module level) o Manage build for the module o Android Plugin (and others if applicable) o MinSDK, TargetSDK declarations o Versioning o Manage dependancies (Maven-style) o Manage build types and flavors o Android Studio will set it all up for you for a basic project

Slide 12

Slide 12 text

A Very Basic App o Create two files (The wizard will do this for us): o src/example/hello_android/MainActivity.java o res/layout/main_activity.xml o Set up manifest (Thank you wizard!) o Declare the main activity and make it launchable o Activity o Lifecycle and Overridable Lifecycle Events o onCreate – Tell the activity which layout to use o Launch it.

Slide 13

Slide 13 text

Expand the App A Little o Use string resources o Add some more controls o TextView, EditText, Button o Find the controls and interact with them o Add onClickListeners o Three different ways to do this (At least) o Access and read properties o Modify the text in a TextView at runtime

Slide 14

Slide 14 text

Expand the App Again o Add another activity o Add some intents to a couple of the buttons o Explicit Intent o Declare the target class o Bundle some extras to pass data between activities o Consume the intent on the other end o Implicit Intent o Declare the desired action and the data URI o Let Android manage where the intent get delivered

Slide 15

Slide 15 text

Resources o Java JDK: http://www.oracle.com/technetwork/java/javase/downloads/inde x.html o Android SDK: https://developer.android.com/sdk/index.html o Android Studio: http://developer.android.com/sdk/installing/studio.html o Android Documentation (Training, API Guides, Reference, tools, etc): https://developer.android.com/training/index.html