Practical Android Projects Lucas Jordan Pieter Greyling



Similar documents
Here to take you beyond Mobile Application development using Android Course details

1. Introduction to Android

Running a Program on an AVD

Table of Contents. Adding Build Targets to the SDK 8 The Android Developer Tools (ADT) Plug-in for Eclipse 9

ADT Plugin for Eclipse

Fahim Uddin 1. Java SDK

Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department. Mobile Computing ECOM Eng. Wafaa Audah.

Android Environment SDK

Jordan Jozwiak November 13, 2011

The "Eclipse Classic" version is recommended. Otherwise, a Java or RCP version of Eclipse is recommended.

COURSE CONTENT. GETTING STARTED Select Android Version Create RUN Configuration Create Your First Android Activity List of basic sample programs

ANDROID INTRODUCTION TO ANDROID

Getting Started with Android Development

«compl*tc IDIOT'S GUIDE. Android App. Development. by Christopher Froehlich ALPHA. A member of Penguin Group (USA) Inc.

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone

How to Create an Android Application using Eclipse on Windows 7

Android Environment SDK

ITG Software Engineering

Android Development. Lecture AD 0 Android SDK & Development Environment. Università degli Studi di Parma. Mobile Application Development

Programming with Android: SDK install and initial setup. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

Introduction to Android

Android Programming: Installation, Setup, and Getting Started

Introduction to Android

Introduction to Android

Beginning Nokia Apps. Development. Qt and HTIVIL5 for Symbian and MeeGo. Ray Rischpater. Apress. Daniel Zucker

Mobility Introduction Android. Duration 16 Working days Start Date 1 st Oct 2013

Beginning BlackBerry 7

Introduction to Android Programming (CS5248 Fall 2015)

-Android 2.3 is the most used version of Android on the market today with almost 60% of all Android devices running 2.3 Gingerbread -Winner of

Robotium Automated Testing for Android

Specialized Android APP Development Program with Java (SAADPJ) Duration 2 months

Developing Android Apps with the ArcGIS Runtime SDK for Android. Dan

A Modular Approach to Teaching Mobile APPS Development

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

The power of root on Android emulators

Homework 9 Android App for Weather Forecast

Tutorial on Basic Android Setup

Introduction to Android. CSG250 Wireless Networks Fall, 2008

Homeschool Programming, Inc.

How To Run A Hello World On Android (Jdk) On A Microsoft Ds.Io (Windows) Or Android Or Android On A Pc Or Android 4 (

Basic Android Setup Windows Version

Android Development Tutorial. Nikhil Yadav CSE40816/ Pervasive Health Fall 2011

Android Setup Phase 2

Android Programming and Security

Workshop on Android and Applications Development

Introduction to Android Development. Jeff Avery CS349, Mar 2013

Introduction (Apps and the Android platform)

Advantages. manage port forwarding, set breakpoints, and view thread and process information directly

Open Source Telemedicine Android Client Development Introduction

Android Development Setup [Revision Date: 02/16/11]

CS378 -Mobile Computing. Android Overview and Android Development Environment

Getting Started with Android Programming (5 days) with Android 4.3 Jelly Bean

Android Application Development

Introduction to Oracle Mobile Application Framework Raghu Srinivasan, Director Development Mobile and Cloud Development Tools Oracle

Android Basics. Xin Yang

DEVELOPING MOBILE APPLICATIONS USING ANDROID

Android Programming. Høgskolen i Telemark Telemark University College. Cuong Nguyen,

1) SETUP ANDROID STUDIO

Oracle FLEXCUBE Direct Banking Android Tab Client Installation Guide Release

Setting Up Your Android Development Environment. For Mac OS X (10.6.8) v1.0. By GoNorthWest. 3 April 2012

Mobile Application Development 2014

INTRODUCTION TO ANDROID CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 11 02/15/2011

OpenCV on Android Platforms

CHAPTER 1: INTRODUCTION TO ANDROID, MOBILE DEVICES, AND THE MARKETPLACE

Reminders. Lab opens from today. Many students want to use the extra I/O pins on

Introduction to Android Development

Lab 0 (Setting up your Development Environment) Week 1

Hello World. by Elliot Khazon

Android Development. Marc Mc Loughlin

How To Develop An Android App On An Android Device

Java 7 Recipes. Freddy Guime. vk» (,\['«** g!p#« Carl Dea. Josh Juneau. John O'Conner

Developer's Cookbook. Building Applications with. The Android. the Android SDK. A Addison-Wesley. James Steele Nelson To

UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP)

Beginning Facebook. Development. Game Apps. Wayne Graham. Apress*

Getting started with Android and App Engine

Android Tutorial. Larry Walters OOSE Fall 2011

Home Course Catalog Schedule Pricing & Savings Training Options Resources About Us

Epidefender Studio Installation notice

Download and Installation Instructions. Android SDK and Android Development Tools (ADT) Microsoft Windows

Wiley Publishing, Inc.

Intel Integrated Native Developer Experience (INDE): IDE Integration for Android*

Developing NFC Applications on the Android Platform. The Definitive Resource

1 Building, Deploying and Testing DPES application

Module Title: Software Development A: Mobile Application Development

An Introduction to Android Application Development. Serdar Akın, Haluk Tüfekçi

Технологии Java. Android: Введение. Кузнецов Андрей Николаевич. Санкт-Петербургский Государственный Политехнический Университет

Android 4.4 App Development Essentials

Installing the Android SDK

Android (Basic + Advance) Application Development

BogDan Vatra and Andy Gryc. Qt on Android: Is it right for you?

Building graphic-rich and better performing native applications. Pro. Android C++ with the NDK. Onur Cinar

Android: Setup Hello, World: Android Edition. due by noon ET on Wed 2/22. Ingredients.

Safe Harbor Statement

Developing In Eclipse, with ADT

Beginning Android 4. Games Development. Mario Zechner. Robert Green

Deepak Patil (Technical Director) iasys Technologies Pvt. Ltd.

Basics. Bruce Crawford Global Solutions Manager

CSA Software Listing Table of Contents. Both Windows and Mac platforms are supported.

Transcription:

Practical Android Projects Lucas Jordan Pieter Greyling Apress s

w«^* ; i - -i.. ; Contents at a Glance Contents --v About the Authors x About the Technical Reviewer xi PAcknowiedgments xii Preface xiii Chapter 1: Android Fundamentals 1 Chapter 2: Development Tools in Practice 49 3: Roll Your Own Android Scripting Environment 105 4: Embedding Lua in Android Applications 155 Chapter 5: Introducing SL4A: The Scripting Layer for Android 193 Chapter 6: Creating a GUI with HTML/JavaScript and AIR 221 Chapter 7: Using REST with Facebook and Twitter 251 Chapter 8: Using the Google App Engine with Android 275 Chapter 9: Game Development: Graphics 311 Chapter 10: Game Development: Animation 341 Chapter 11: App Inventor 361 387 iv

Contents Contents at a Glance iv OAbout the Authors x About the Technical Reviewer xi Acknowledgments xii I Preface xiii I Chapter 1: Android Fundamentals 1 What Is Android? 2 Installing the Android SDK 2 Java Development Kit (JDK) 3 Android SDK and Target Platforms 3 Android SDK Test Drive 9 Android Architecture and Background 20 The Android Platform Stack 21 Android Component Architecture 23 The Android Runtime: Dalvik Virtual Machine (DVM) 23 Using an Integrated Development Environment (IDE) 27 Working with Eclipse 28 On the Web: Eclipse for Android Development 28 Quickstart: The Eclipse Android Development Tools (ADT) Plugin 29 Working with NetBeans 33 On the Web: NetBeans for Android Development 33 ' Quickstart: The NetBeans Android (NBAndroid) Plugin 34 Working with IntelliJ IDEA Community Edition 42 On the Web: JetBrains IntelliJ IDEA for Android Development 42 Quickstart: The IntelliJ IDEA Android Plugin 43 Summary 47

Chapter 2: Development Tools in Practice 49 Coding with the SDK and a Programmer's Editor 50 Development Environment Dependencies 50 Ensure that Development Kit Locations Are on the Path 50 Preparing an Android Virtual Device (AVD) 51 Frequently Used Android Development Kit Tools 52 Working with the Android Tools and a Code Editor 53 Selecting a Code Editor 53 Configuring the Editor for Android Work 56 The Example Application Project 58 Generating the Foundation Android Project 59 The Android Project Directory Structure 60 Preparing to Run the Example Application 61 Starting a Debugging Session 61 Replacing the Default Generated Code 63 Building and Installing the Project Example Code 64 Creating a Log Filter for the Application in the DDMS 64 Running the Example Application 66 What Does the Demo Application Do? 67 A Walk through the Core Application Files 74 Android Coding How to 81 Using the Android Log API 81 Centralizing Application GUI Initialization Code 85 Exiting an Application Activity 86 Enabling and Disabling Buttons (and other Views) 87 Creating Controls Dynamically (at Runtime in Code) 88 Making an Android Toast 90 Showing an Android Alert Dialog 90 Creating and Showing an Android System Notification 91 Using a Private Application File 92 Making Menus 95 Migrating the Example Application to Eclipse/ADT 97 Make a Copy of the Project 97 Open Eclipse with the ADT Plugin Installed 97 Create a New Android Project from the Copy of the Project 97 Create and Test a New Run Configuration for the Project 98 Deploying to a Real Device 99 Creating a Signed APK Package of the Example Application 101 Summary 104 Chapter 3: Roll Your Own Android Scripting Environment 105 Designing a Scripting Environment 106 The Components of a Scripting System 106 The Component Roles in a Scripting System 107 Designing for Resource-Constrained Systems 109 j Multi-Threading for Background Code 110 Programming with BASIC 110 A BASIC Backgrounder 111 vi

Cocoa A BASIC Interpreter for Java 111 Outlining the Code Projects for This Chapter 112 The Cocoa-BASIC AWT Project 112 Understanding the Cocoa-BASIC AWT Application Design 112 Running the Cocoa-BASIC AWT Desktop Application 114 Reviewing the Cocoa-BASIC AWT Source Code 118 The CocoaDroid Project 120 A Preflight Checklist 120 Understanding the CocoaDroid Application Design 121 Running the CocoaDroid Android Application 122 Summary 153 IB Chapter 4: Embedding Lua in Android Applications 155 Introducing Lua and Kahlua2 156 Lua Resources 156 Kahlua2 Resources 157 Using Kahlua2 in Your Android Java Applications 157 Development Environment Configuration 158 The Kahlua2 Project 158 Setting up the Kahlua2 Runtime Files Project 159 Building from the Console 160 Building from an IDE 160 The Kahlua2 Runtime Libraries 161 The Kahlua2 Android Interpreter Project 162 Setting up the Project 162 Building from the Console 163 Building from an IDE 163 Running the Kahlua2 Android Interpreter 164 Understanding the Basics of Embedding Kahlua2 165 The KahluaDroid Project 168 Running the KahluaDroid Application 169 Running Lua Code On or Off the Main GUI Thread 176 Exposing Android Application Methods to Kahlua2 180 Calling Application Methods as Lua Functions 183 Implementing an Application Startup Script 185 Summary 192 Chapter 5: Introducing SL4A: The Scripting Layer for Android 193 What Is Scripting Layer for Android? 194 About SL4A 194 The SL4A License 194 Using SL4A 194 SL4A Resources 195 The SL4A Code Repository 195 Running SL4A in the Android Emulator 196 Development Environment Configuration 196 Downloading the SL4AAPKs 197 Installing the SL4AAPK on the Android Emulator 197 Running SL4A on the Android Emulator 198 vii

viii Installing SL4A Interpreters 202 Understanding Scripting Layer for Android 209 Communicating Using JavaScript Object Notation (JSON) 209 Summarizing the SL4A Architecture 210 Reviewing Local Proxy Implementations 211 Getting the SL4A Source Code 215 Cloning the SL4A Source Code 216 SL4A Hello World Examples 219 Summary 220 Chapter 6: Creating a GUI with HTML/JavaScript and AIR 221 Setting Up an Android Project to Display a Web Application 222 The Android Project 223 Calling Android Methods from JavaScript 225 JavaScript Application 226 Graphics and Animation 231 User Interaction 235 JavaScript Summary 238 Using Flash and Flex Apps on Android with AIR 238 Writing a Flex Application for Android 239 Building and Deploying 240 Creating the Flex Ul with MXML 244 Writing ActionScript 246 Summary 250 Chapter 7: Using REST with Facebook and Twitter 251 Understanding REST 252 REST and JSON 253 REST from an Android Application 255 Asynchronous Tasks 258 Twitter 259 Examples in Code 261 Tweeting on Behalf of the User 265 Confirming the User Wants to Tweet 266 Understanding the Facebook API 268 Facebook and Authentication 268 Facebook's Social Graph API 272 Summary 274 Chapter 8: Using the Google App Engine with Android 275 Introducing Google App Engine 276 Getting Started with GAE 276 Using Eclipse with GAE 278 GAE Project Structure 280 Charges for the Google App Engine Service 283 Google App Engine Services 284 Examining a Sample GAE Application 287 Adding the HighScore Service 290 Querying the HighScore Service 293 Consuming GAE Services with Android 297

Exploring the Top Ten Activity 300 Viewing the Users of a Game 303 Viewing a User's Location (MapView) 305 Summary 310 Chapter 9: Game Development: Graphics 311 Introducing the Android View Package 312 Understanding XML Layout 312 Layout in Code.T..317 Custom Component 320 Understanding the Drawable Class 328 Drawable Class 328 Drawable Subclasses 330 NinePatchDrawable 334 Direct Rendering 336 Summary 340 Chapter 10: Game Development: Animation... 341 Android Animations 341 Creating Views and Animations 343 Frame By Frame Animations 353 Mixing Views and SurfaceViews 359 Summary 360 Chapter 11: App Inventor 361 Setting Up App Inventor 361 Working with Blocks 365 Understanding the Types of Blocks 367 Creating Application Logic with the Block Editor 376 Limitations of App Inventor 383 Limited Set of Components 384 Limitations in Block Editor 385 Summary 386 Index 387 ix