Crash Course in Android Development. 2 Content  Installing the ADT  Hardware and OS requirements  Java  ADT Bundle  Eclipse Project Setup  Drawing.

Slides:



Advertisements
Similar presentations
Programming with Android: SDK install and initial setup Luca Bedogni Marco Di Felice Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna.
Advertisements

All About Android Introduction to Android 1. Creating a New App “These aren’t the droids we’re looking for.” Obi-wan Kenobi 1. Bring up Eclipse. 2. Click.
Basic 2D Graphics in Android. Android Graphics Programming There are many ways to do graphics programming in Android – 2D vs. 3D – static vs. dynamic.
Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
1 Mobile Computing Mobile First (formerly Worklight) Copyright 2015 by Janson Industries.
Android: Hello World Frank Xu Gannon University. Steps Configuration ▫Android SDK ▫Android Development Tools (ADT)  Eclipse plug-in ▫Android SDK and.
Basic, Basic, Basic Android. What are Packages? Page 346 in text Package statement goes before any import statements Indicates that the class declared.
Android 1: Background Kirk Scott Buzzwords 1.2 Development Software 1.3 Getting Started 1.4 Preliminaries to Trying to Make It Work the First Time.
Android Application Development with Java UPenn CS4HS 2011 Chris Murphy
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
How to make it work? Doncho Minkov Telerik Academy academy.telerik.com Technical Trainer
Android Development (Basics)
@2011 Mihail L. Sichitiu1 Android Introduction Hello World.
INTERNATIONAL SUMMER ACADEMIC COURSE UNIVESITY OF NIS ISAC – Android programming.
Emerging Platform#4: Android Bina Ramamurthy.  Android is an Operating system.  Android is an emerging platform for mobile devices.  Initially developed.
Chien-Chung Shen Manifest and Activity Chien-Chung Shen
Better reference the original webpage :
Mobile Programming Lecture 1 Getting Started. Today's Agenda About the Eclipse IDE Hello, World! Project Android Project Structure Intro to Activities,
Introduction to Android Programming Content Basic environmental structure Building a simple app Debugging.
Cosc 5/4730 Information, Resources, and basic GUI concepts.
CS5103 Software Engineering Lecture 08 Android Development II.
© Keren Kalif Intro to Android Development Written by Keren Kalif, Edited by Liron Blecher Contains slides from Google I/O presentation.
1 Mobile Computing Set Up Copyright 2015 by Janson Industries.
Android Activities 1. What are Android Activities? Activities are like windows in an Android application An application can have any number of activities.
Android. The Eclipse IDE Installation Requirements: Eclipse Java Windows All must match (32-bit OR 64-bit) If you have a 64-bit OS & 32-bit browser,
DUE Hello World on the Android Platform.
Social Media Apps Programming Min-Yuh Day, Ph.D. Assistant Professor Department of Information Management Tamkang University
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Presented By: Muhammad Tariq Software Engineer Android Training course.
Android - Broadcast Receivers
Configuring Android Development Environment Nilesh Singh.
Android Development Environment Environment/tools Windows Eclipse IDE for Java Developers (v3.5 Galileo) Java Platform (JDK 6 Update 18) Android.
Android Hello World 1. Click on Start and type eclipse into the textbox 2.
Creating an Example Android App in Android Studio Activity lifecycle & UI Resources.
First Venture into the Android World Chapter 1 Part 2.
Announcements Homework #2 will be posted after class due Thursday Feb 7, 1:30pm you may work with one other person No office hours tonight (sorry!) I will.
Android Boot Camp Demo Application – Part 1. Development Environment Set Up Download and install Java Development Kit (JDK) Download and unzip Android.
Graphics Concepts CS 2302, Fall /17/20142 Drawing in Android.
INTRODUCTION TO JAVA AND ANDROID. Slide 2 Our Ecosystem Java Eclipse Android SDK.
TODAY Android Studio Installation Getting started Creating your 1 st App Beginning to understanding Intents.
TCS Internal Maps. 2 TCS Internal Objective Objective :  MAPS o Integration of Maps.
Intoduction to Andriod studio Environment With a hello world program.
Basic 2D Graphics in Android. Android Graphics Programming There are many ways to do graphics programming in Android – 2D vs. 3D – static vs. dynamic.
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
Guide To Develop Mobile Apps With Titanium. Agenda Overview Installation of Platform SDKs Pros of Appcelerator Titanium Cons of Appcelerator Titanium.
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
Introduction to Android Chapter 1 1. Objectives Understand what Android is Learn the differences between Java and Android Java Examine the Android project.
Android Programming.
Lab7 – Appendix.
Introduction to android
Android Introduction Hello World
Android 01: Fundamentals
Android Application Development 1 6 May 2018
Android Studio, Android System Basics and Git
Android Introduction Hello World.
Development-Introduction
Sensors, maps and fragments:
Mobile Device Development
CIS 470 Mobile App Development
CMPE419 Mobile Application Development
Programming Mobile Applications with Android
CIS 470 Mobile App Development
Emerging Platform#3 Android & Programming an App
Cosc 4730 An Introduction.
CMPE419 Mobile Application Development
CMPE419 Mobile Application Development
CIS 470 Mobile App Development
CIS 694/EEC 693 Android Sensor Programming
Presentation transcript:

Crash Course in Android Development

2 Content  Installing the ADT  Hardware and OS requirements  Java  ADT Bundle  Eclipse Project Setup  Drawing in Android  Animation in Android

3 John Casey  Dr John Casey   Room 3008, building 183  Phone: ext. 6003

4 My Experience  Oracle Certified Java Programmer (OCJP)  Programmer  P2P, Sockets, Distributed Systems, Information Retrieval  Motor Registry System – State of Tasmania  Fines and Infringement Notices Database – State of Tasmania  LifeLink - Births, Deaths and Marriages State of NSW  Mobile Research Projects  …  Educator  Deakin University, Melbourne  Unitec

5 Android Gremlins  SDK is very complicated  There are 4-5 separate components to install and configure and something can go wrong at each stage  The Android SDK has lots of bugs  Android can have weird interactions with the OS and Hardware  Many give up after failing to install and configure Java, Android and Eclipse

6 First Steps  Work out whether you are running a 32-bit or 64-bit OS  Control Panel- >System and Security->System

7 Do you have Java Installed?  downloads/index.html downloads/index.html

8 Download 32-bit OR 64-bit Version

9 Java already installed?  Drop to a Command Prompt

10 Download the ADT Bundle   The number of bits must match! for OS, Java and ADT Bundle

11 Download the ADT Bundle  Make a cup of tea / coffee while the ADT Bundle downloads  385 MB later.... Extract the ADT Bundle.

12 Extract the ADT Bundle  Extract files to c:\android-adt

13 Open the SDK Manager

14 Update the SDK  Be careful not to download the Google Glass packages  Android API 18 is a good stable version of Android

15  More Coffee...

16 Run Eclipse

17 Update Eclipse

18 Android Developer Toolkit  Lots of steps where things can go wrong  Can alternatively build your own environment OR you can also use Android Studio Beta  Follow the steps outlined above though and you can’t go too far wrong  Haven’t even started coding yet :D

19 Android Need to Know  Nice to know a general purpose programming language like Java / C#  Nice to know a bit about Object Oriented programming  Variables + Functions  Inheritance and Subclassing  Functions and parameters  A bit about XML  Have a lot of patience – Lots of bugs + Gotchas

20 Starting Eclipse  Keep the default workspace:  C:\Program Files\Eclipse Android\Workspace  API19 only available on lab machines

21 New Android Project  Use the wizard...  File ->New -> Other -> Android ->Android Project

22  Match up the version of Android with the version that you downloaded!  Minimum version should also point to Android 18

23

24

25

26

27

28 Android Projects  Main class file is the Activity public class MainActivity extends Activity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); }

29 Android Structure  Source Code folder  Generated Code folder  Resource folder  Images  Layouts  Menus  Strings  AndroidManifest.xml

Android Manifest <manifest xmlns:android=" package="com.example.test“ android:versionCode="1“ android:versionName="1.0" > <application android:allowBackup="true“ > <activity android:name=".MainActivity" >

31 Android Manifest  Defines configuration of the project using XML  Defines project resources  Images and Icons  Layouts  Menus  Hardware needed  Etc.  Defines the main activity for the Android Project 31

32 First Android Project – Stick Man  We will hard code everything to make it easier  Won’t be touching anything in the resources directory

33 Stick Man and House  Create a new View class

34 Stickman and House  Extend / inherit from android.view.View  Set the package  Class name  Superclass  Tick create constructors from super class.

35 Stickman and House package com.example.test; import android.content.Context; import android.util.AttributeSet; import android.view.View; public class StickmanHouse extends View { public StickmanHouse(Context context) { super(context); } public StickmanHouse(Context context, AttributeSet attrs) { super(context, attrs); } public StickmanHouse(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); }

36 Drawing in Android  Can draw various graphical primitives in Android using a View classes onDraw(Canvas canvas) method  By default onDraw(Canvas canvas) does not do anything...

37 Drawing in Android  The Canvas co-ordinate system starts at the top-left hand corner of the screen  Paint objects are used to control the size, style and colour of the shapes drawn by the Canvas object paint.setColor(Color.RED); canvas.drawCircle(left, top, 10, paint);

38 Stickman and House  By default the StickmanHouse view does not draw anything  The super classes onDraw(Canvas canvas) method does not do anything  You will need to import android.graphics.*;  Implement the onDraw method as protected void onDraw(Canvas canvas) { Paint paint = new Paint(); paint.setColor(Color.RED); canvas.drawCircle(50, 50, 15, paint); }

39 Link StickmanView to MainActivity package com.example.test; import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new StickmanHouse(getApplicationContext())); }

40 Setting up the Emulator  Choose the Java perspective  Window -> Open Perspective -> Java

41 Setting up the Emulator  Press the Android Virtual Device button  It looks like a little mobile phone

42 Setting up the Emulator  Press the new button

43 Create new Virtual Device  Set the following parameters  Keep the device screen smaller – larger devices are very slow  Select an x86 CPU  Press OK

44 Start the new Virtual Device  Takes about 5 – 10 minutes to start depending on your hardware

45 Emulator

46 Running your App – Right Click Project

47 Running your App  Right Click Project  Select Run As  Android Application  The application will run on your emulator (eventually)...

48 Activity  Build a stickman figure in teams of 2 people, using canvas methods such as:  canvas.drawRect(25, 125, 150, 250, paint);  canvas.drawLine(200,125,200,200,paint);  canvas.drawCircle(200, 115, 15, paint);  canvas.drawArc(new RectF(200-10,115- 8,200+10,115+8 ), 0, 180, true, paint);

49 What have we done?  A lot on project setup  Create project  Create emulator  A bit on object oriented programming  A bit on object creation / allocation  A lot on drawing objects using the canvas and paint objects  Basics of Java language

50 Bouncing Ball Animation  Declare global integer variables  Use global vars to specify co-ordinates of the circle  Use invalidate() method to force a screen redraw

Animation Code int x = 0; int y = protected void onDraw(Canvas canvas) { Paint paint = new Paint(); paint.setColor(Color.RED); canvas.drawCircle(x,y, 15, paint); x = x +1; y = y +1; invalidate(); }  We need some guard conditions otherwise the circle will cont. to move to the right forever.

Boundary Guards int x = 150; int y = 0; int deltax = 1; int deltay = protected void onDraw(Canvas canvas) { Paint paint = new Paint(); paint.setColor(Color.RED); canvas.drawCircle(x,y, 15, paint); if(x > getWidth()) { deltax = -1; } x = x +deltax; y = y +deltay; invalidate(); }  New delta variables to control movement  New guard conditions to reflect ball movement on right hand side  Your job implement guard conditions for the top, bottom and left sides

53 Summary  Basic animation  Global variables  Math operators  Assignments operators  If statements  Challenge get more circles on screen using arrays  Get them to collide with each other  If you want to learn more take the Mobile class over Summer / Sem 1, 2015.