27
Getting Started with Android application development Dept. of Computer Science and Engineering

Session 2 beccse

Embed Size (px)

DESCRIPTION

Android Workshop PPt's

Citation preview

Page 1: Session 2 beccse

Dept. of Computer Science and Engineering

Getting Started withAndroid application development

Page 2: Session 2 beccse

Dept. of Computer Science and Engineering

What is required for Android application development?

• Latest version of JDK• Android SDK (Windows/Linux)• IDE (Eclipse/Anything of your choice)• Android Eclipse Add-on (ADT)

Page 3: Session 2 beccse

JDK or Java JDK

• Java SE development kit• Its an essential component, because every app are written using java language• so, you need to have JDK to compile and generate the java files at the run time • download latest version of JDK• why java only..???

Dept. of computer Science and Engineering

Page 4: Session 2 beccse

Dept. of Computer Science and Engineering

Eclipse

• It is the preferred IDE (integrated development environment) by the Android team.

• Its multi language software development environment featuring an extensible plug-in system.

• Download Eclipse of any version on your machine.

• You can download it here www.eclipse.org

• Six editions are available, for all types of OS.

Page 5: Session 2 beccse

Dept. of Computer Science and Engineering

Android SDK

• Android SDK (software development kit) contains a debugger, libraries, an emulator, documentation, sample code, and tutorials.

• Android SDK initially contains only the basic tools, It does not contain all android platforms and platforms tools.

• Therefore, you must install the platform tools and atleast one version of the Android platform.

•Download Android SDK zip file from: http://developer.android.com/sdk

Page 6: Session 2 beccse

Dept. of Information Science and Engineering

Android emulator

• Android SDK Includes a mobile device emulator.• Its virtual mobile device that runs on your computer, The emulator lets you develop & test android apps without using a physical device.• So, you have to create AVDs (Android Virtual device), these are emulator instances.• you can create as many AVDs you want in order to test your app with different configurations.

Page 7: Session 2 beccse

Dept. of Information Science and Engineering

ADT (android development tools)

• Its an extension for eclipse IDE. • Its a custom plug-in offered by android.• Designed to give powerful, integrated environment in which you can build android apps.• It extends the capabilities for eclipse to let you quickly set up Android projects.

Page 8: Session 2 beccse

Dept. of Computer Science and Engineering

Configuring Android SDK into Eclipse

Page 9: Session 2 beccse

Dept. of Computer Science and Engineering

Page 10: Session 2 beccse

Dept. of Computer Science and Engineering

Page 11: Session 2 beccse

Dept. of Computer Science and Engineering

Page 12: Session 2 beccse

Dept. of Computer Science and Engineering

Page 13: Session 2 beccse

Dept. of Computer Science and Engineering

Page 14: Session 2 beccse

Dept. of Computer Science and Engineering

Page 15: Session 2 beccse

Dept. of Computer Science and Engineering

Page 16: Session 2 beccse

Dept. of Computer Science and Engineering

Page 17: Session 2 beccse

Dept. of Computer Science and Engineering

Page 18: Session 2 beccse

Dept. of Computer Science and Engineering

Page 19: Session 2 beccse

Dept. of Computer Science and Engineering

DDMS

• Android ships with a debugging tool called the Dalvik Debug Monitor Server (DDMS).

• When DDMS starts, it connects to android debug bridge (this lets us communicate with an emulator instance or connected android device).

• When a device is connected, a VM monitoring service is created between adb and DDMS, which notifies DDMS when a VM on the device is started or terminated.

• Once a VM is running, DDMS retrieves the the VM's process ID (pid), via adb, and opens a connection to the VM's debugger, through the adb daemon (adbd) on the device.

• DDMS can now talk to the VM using a custom wire protocol.

Page 20: Session 2 beccse

Dept. of Information Science and Engineering

Debugging Environment

Page 21: Session 2 beccse

Dept. of Information Science and Engineering

Running DDMS

• DDMS is integrated into Eclipse and is also shipped in the tools/ directory of the SDK. DDMS works with both the emulator and a connected device. If both are connected and running simultaneously, DDMS defaults to the emulator.

• From eclipse: Click Window -> Open Perspective -> Other… -> DDMS

Page 22: Session 2 beccse

Dept. of Computer Science and Engineering

Logcat:

• The Android logging system provides a mechanism for collecting and viewing system debug output.

• Logs from various applications and portions of the system are collected in a series of circular buffers, which then can be viewed and filtered by the logcat command.

• You can use logcat from an ADB shell to view the log messages.

Page 23: Session 2 beccse

Dept. of Computer Science and Engineering

Contents of Project Folder

Project name- Folder name1.1 src1.2 Android 2.11.3 gen1.4 assets1.5 res1.6 AndroidManifest.xml

1. 1 src-> package folder-> java file (activity name)contains the java file, which contains the application code.This is something that the user can do, translated into program. It

corresponds to a screen.

1.2 Android 2.1 -> this folder has all the default packages of the particular version of android,. i.e which contains all the class libraries needed for android application

Page 24: Session 2 beccse

Dept. of Information Science and Engineering

1.3 gen -> contains r.java file, a compiler generated file that references all the resources found in your project.

1.4 assets -> this folder contains all the assets used by your application, such as HTML, text files, databases, etc.

Page 25: Session 2 beccse

Dept. of Computer Science and Engineering

1.5 Res- This folder contains the images which are being used and UI layout.

1. drawable: intended for drawing (HDPI, MDPI, LDPI)

2. Layout: main.xmlThis contains the GUI design for the android

application.GUI can be done by either writing the xml code , or by drag and drop option.

3. Values: Strings.xml Contains String and theme elements

Page 26: Session 2 beccse

Dept. of Computer Science and Engineering

1.6 AndroidManifest.xml

• This contains the following tabs Manifest, Application, Permission, Instrumentation and AndroidManifest.xml

• This contains the package name, android version name, SDK version.• Any new activity is added, then it has to be declared over here.

• This defines the components of the application and their relationships. It gives the permissions to components of the application as to what it can do with users.

• The manifest file must declare all components in the application and should also declare all application requirements, such as the minimum version of Android required and any hardware configurations required

Page 27: Session 2 beccse

Dept. of Computer Science and Engineering

Lunch Break