42
DEVELOPMENT

Basic android development

Embed Size (px)

Citation preview

Page 1: Basic android development

BASIC ANDROID DEVELOPMENT

Page 2: Basic android development

WHAT IS ANDROID?

Google created software stack for creating comprehensive Mobile Applications and Software to realize the full potential of one’s Mobile handset and its possibilities.

Comprehensive software stack of mobile devices that includes an operating system, middleware and key application.

Used in Mobile Technology through its innovation module of The Android Software Development Kit (SDK).

Page 3: Basic android development

ITS VERSIONS Pre-commercial release versions (2007–2008)

Android Alpha Android beta

Version history by API level Android 1.0 (API level 1) Android 1.1 (API level 2) Android 1.5 Cupcake (API level 3) Android 1.6 Donut (API level 4) Android 2.0 Eclair (API level 5) Android 2.0.1 Eclair (API level 6) Android 2.1 Eclair (API level 7) Android 2.2–2.2.3 Froyo (API level 8) Android 2.3–2.3.2 Gingerbread (API level 9) Android 2.3.3–2.3.7 Gingerbread (API level 10) Android 3.0 Honeycomb (API level 11) Android 3.1 Honeycomb (API level 12) Android 3.2 Honeycomb (API level 13) Android 4.0–4.0.2 Ice Cream Sandwich (API level 14) Android 4.0.3–4.0.4 Ice Cream Sandwich (API level 15) Android 4.1 Jelly Bean (API level 16) Android 4.2 Jelly Bean (API level 17) Android 5.0 Lime Pie (To be Launched Soon...)

Page 4: Basic android development

More About Android Company / developer : Google / Open Handset Alliance

Android Open Source ProjectProgrammed in : C, C++, JavaOS family : Unix-likeInitial release : September 23, 2008Latest release : 4.2.2 Jelly Bean / February 11,

2013Marketing target : Smartphones, Tablet computersPackage manager : Google Play, APKSupported platforms : ARM, MIPS, x86, I.MXKernel type : Monolithic (modified Linux

kernel)License : Apache License 2.0

Linux kernel patches under GNU GPL

Page 5: Basic android development

IMPACT ON TODAY’S MARKETAndroid powers devices from some of the best handset and

tablet manufacturers in the world, like Samsung, HTC, Motorola, Sony, Asus and more.

Flip-out keyboard or on-screen, from smartphone to tablet and at every possible price point, there’s an Android device for everyone making it the world's most widely used smartphone platform.

Android devices can be controlled with voice by Simply touching the microphone on the keyboard and talking to write emails, SMS etc. Text appears without any span of time.

Page 6: Basic android development

• Helps in creating Open Sourced Mobile Applications.Communication ApplicationBusiness ApplicationMultimedia ApplicationInternet ApplicationFun/Entertainment ApplicationGaming ApplicationUtility and Security Application

• Features like Face Unlock — which uses facial recognition to let you unlock your device with a smile.• Android Beam — which lets you share contacts, directions and more by touching two devices together.

Page 7: Basic android development

The Android software development kit (SDK) includes a comprehensive set of development tools. These include a debugger, libraries, a handset emulator based on QEMU, documentation, sample code, and tutorials.

Development platforms include Linux, Mac OS X, Windows XP.The officially supported integrated development environment (IDE) is Eclipse using the Android Development Tools (ADT) Plugin.

Page 8: Basic android development

Google provides the Android Development Tools (ADT) to develop Android applications with Eclipse. ADT is a set of components (plug-ins) which extend the Eclipse IDE with Android development capabilities. ADT contains all required functionalities to create, compile, debug and deploy Android applications from the Eclipse IDE. ADT also allows to create and start AVDs. The Android Development Tools (ADT) provides specialized editors for resources files, e.g. layout files. These editors allow to switch between the XML representation of the file and a richer user interface via tabs on the bottom of the editor.

Page 9: Basic android development

HOW TO CREATE A NEW PROJECT? XML DESIGNING EMULATOR DEBUGGING THE APPLICATION FOLDERS IN ANDROID APPLICATION CANVAS CLASS FOR GAMING GOOGLE PLAY (ANDROID MARKET) DEPLOYING

Page 10: Basic android development
Page 11: Basic android development
Page 12: Basic android development
Page 13: Basic android development
Page 14: Basic android development

ADDITIONAL INFORMATION Application Name : This name is used as the title of your

application launcher icon when it is installed on a device.

Project Name : This text is used as the name of the folder where your project is created.

Package Name : This class package namespace creates the initial package structure for your applications code files and is added as the package attribute in your application's Android manifest file.

Minimum Required SDK : This setting indicates the lowest version of the Android platform that your application supports. This value sets the min SdkVersion attribute in the <uses-sdk> element of your manifest file.

Page 15: Basic android development

ADDITIONAL INFORMATION Target SDK : This setting indicates the highest version of

Android with which you have tested with your application and sets the target SDK Version attribute in your application's' manifest file.

Compile With API version : This setting specifies what version of the SDK to compile your project against. It is strongly recommended to use the most recent version of the API.

Theme : This setting specifies which standard Android visual style is applied to your application.

Google Play requires that every Android application uses its own unique package. Therefore, reverse domain name is used as package name. This avoids collisions with other Android

applications.

Page 16: Basic android development
Page 17: Basic android development

The Padding, style and background colour of the icon can also be changed. There are various icons in the Clipart which can be chosen according to one’s convenience. One can switch on to text instead of any image as an icon.

Page 18: Basic android development
Page 19: Basic android development
Page 20: Basic android development
Page 21: Basic android development

XML DESIGNINGThe XML Designing can be done in two ways :

By Dragging, Dropping and Positioning items from the Palette to its Graphical Layout (i.e. the UI view).

Through Coding in .xml window (basically the backend of Graphical Layout) .

One can select AppTheme, UI mode, alter changes in height, width, margins and gravity, switch from portrait to landscape or vice versa according to his/her convenience.

Page 22: Basic android development
Page 23: Basic android development
Page 24: Basic android development

DIFFERENT TYPES OF LAYOUTSFrameLayout is a layout manager which draws all child elements

on top of each other. Which allows to create nice visual effects. LinearLayout puts all its child elements into a single column or

row depending on the android:orientation attribute. Possible values for this attribute are horizontal and vertical, horizontal is the default value.

LinearLayout supports assigning a weight to individual children via the android:layout_weight layout parameter. This value specifies how much of the extra space in the layout is allocated to the View.

RelativeLayout allow to position the widget relative to each other. This allows for complex layouts. If you want to center a single component., just add one component to the RelativeLayout and set the android:layout_centerInParent attribute to true.

GridLayout was introduced with Android 4.0. This layout allows you to organize a view into a Grid. GridLayout separates its drawing area into: rows, columns, and cells.

Page 25: Basic android development

UNDERSTANDING SYNTAXES The match_parent value tells the to maximize the widget in its

parent. The wrap_content value tells the layout to allocate the minimum amount so that widget is rendered correctly.

The ScrollView class can be used to contain one View that might be to big too fit on one screen. ScrollView will is this case display a scroll bar to scroll the context.

The android:fillViewport="true" attribute ensures that the

scrollview is set to the full screen even if the elements are smaller then one screen.

android:versionName and android:versionCode specify the version

of your application. versionName is what the user sees and can be any String and versionCode must be an integer.

Page 26: Basic android development

UNDERSTANDING SYNTAXES android:name="android.intent.category.LAUNCHER" defines that

this application is added to the application directory on the Android device.

The @string/app_name value refers to resource files which contain the actual value of the application name.

The uses-sdk part of the AndroidManifest.xml file defines the minimal SDK version for which your application is valid.

Various tags used in AndroidManifest.xml are manifest, uses-sdk, application, activity, intent filter, action etc.

Other tags which basically promote designing are RelativeLayout, TextView, EditText, Button etc.

Page 27: Basic android development

VIEWS AND LAYOUT MANAGERViews are user interface widgets, e.g. buttons or text fields.

Widgets are interactive components which are primarily used on the Android homescreen.The base class for all views is the android.view.View class. Views have attributes which can be used to configure their appearance and behavior.

A layout manager is responsible for arranging other views. The base class for these layout managers is the android.view.ViewGroup class which extends the View class.

Layout managers can be nestled to create complex layouts. You should avoid nesting them too deeply as this has a

negative impact on the performance.

Page 28: Basic android development

ITEMS WHICH CAN BE DRAGGED AND DROPPED IN THE UI VIEW OF .XML FILE

Form Widgets : Buttons, Checkbox, Radio Buttons, Spinner etc.

Text Fields : Textboxes, Password Boxes, Number Boxes etc.

Layouts : Grid Layout, Linear Layouts, Frame Layout etc.

Composite : Tabs, List View, Scroll View, Search View etc. Images And Media : Image Button, Video View, Gallery etc.Time And Date : Time Picker, Date Picker, Calendar View etc.Transitions : Image Switcher, Text Switcher, Stack View

etc.Advanced : Texture View, Surface View, Number Picker

etc.Others : Text Clock.

Page 29: Basic android development
Page 30: Basic android development
Page 31: Basic android development

EMULATOR The Android SDK includes a virtual mobile device emulator that runs on

your computer. The emulator lets you prototype, develop and test Android applications without using a physical device.

It runs a full Android system stack, down to the kernel level, that includes a set of preinstalled applications (such as the dialer) that you can access from your applications. You can choose what version of the Android system you want to run in the emulator by configuring AVDs, and you can also customize the mobile device skin and key mappings. When launching the emulator and at runtime, you can use a variety of commands and options to control its behavior.

During development and testing of your application, you install and run your application in the Android emulator. You can launch the emulator as a standalone application from a command line, or you can run it from within your Eclipse development environment.

Page 32: Basic android development
Page 33: Basic android development
Page 34: Basic android development
Page 35: Basic android development

DEBUGGING Debugging allows you to run a program interactively while

watching the source code and the variables during the execution.

 By breakpoints in the source code you specify where the execution of the program should stop. To stop the execution only if a field is read or modified, you can specify watchpoints .

 Breakpoints and watchpoints can be summarized as stop points.  Once the program is stopped you can investigate variables,

change their content, etc.

 If you are developing in Eclipse with the ADT plugin, you can use the built-in Java Debugger, along with DDMS, to debug your applications.

Page 36: Basic android development

.

Page 37: Basic android development

FOLDER STRUCTURE OF ANDROID APPLICATION

MANIFEST FILE :

xmlns:android Defines the Android namespace. This attribute should always be set to "http://schemas.android.com/apk/res/android".

Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory.

It describes the components of the application — the activities, services, broadcast receivers, and content providers that the application is composed of.

It names the classes that implement each of the components and publishes their capabilities.

Page 38: Basic android development

MANIFEST FILE It determines which processes will host application components.

It declares which permissions the application must have in order to access protected parts of the API and interact with other applications.

It also declares the permissions that others are required to have in order to interact with the application's components.

It declares the minimum level of the Android API that the application requires.

It lists the libraries that the application must be linked against.

Page 39: Basic android development

RES AND GEN FOLDERRES : Android supports that resources, like images and certain XML

configuration files, can be keep separate from the source code. These resources must be defined in the res directory in a special folder dependent on their purpose. You can also append additional qualifiers to the folder name to indicate that the related resources should be used for special configurations, e.g. you can specify that a resource is only valid for a certain screen size.

GEN : The gen directory in an Android project contains generated values. R.java is a generated class which contains references to certain resources of the project. If you create a new resource, the corresponding reference is automatically created in R.java via the Eclipse ADT tools. These references are static integer values and define IDs for the resources. The Android system provides methods to access the corresponding resource via these IDs.

Page 40: Basic android development

CANVAS APIThe Canvas API allows to create complex graphical effects. The Canvas class provides the drawing methods to draw on

a bitmap and the Paint class specifies how you draw on the bitmap.

The Canvas class The Canvas object contains the bitmap on which you draw. Provides methods for drawing operations, e.g. drawARGB()

for drawing a color, drawBitmap() to draw a Bitmap, drawText() to draw a text, drawRoundRect() to draw a rectangle with rounded corners and much more.

The Paint Class : The Paint class allows to specify the color, font and certain effects for the drawing operation.

Page 41: Basic android development

GOOGLE PLAY (ANDROID MARKET)

Google offers the Google Play service in which programmers can offer their Android application to Android users.

Google phones include the Google Play application which allows to install applications.

Google Play also offers an update service, e.g. if a programmer uploads a new version of his application to Google Play, this service will notify existing users that an update is available and allow to install it.

Google Play used to be called Android Market.

Page 42: Basic android development

DEPLOYING AN APPBefore you can deploy an app, you must verify your domain.Open the Marketplace page at (www.google.com/appsmarketplace)

for the app you want to deploy. In the upper-right corner, click Add it now.Enter your Google Apps domain name and click on Go.Sign in to the Google Admin console. The Admin console for your Google Apps domain appears, and you

are presented with the terms of service. Read it, then click I agree. Continue.

If the app requires access to Google APIs, those APIs are listed here. To give the app access to the necessary APIs, click Grant data access.

Click Enable app now or Enable app later.After you add your first app from the Marketplace, it can take up to

24 hours for user cookies to refresh and for that app to appear in the more menu in the universal navigation bar.