android development basics

36
A.Mohammed Adam, Activist on Free Software Foundation Tamil Nadu, .

Upload: mohammed-adam

Post on 05-Jul-2015

82 views

Category:

Technology


0 download

DESCRIPTION

This is about Android Developement Basics

TRANSCRIPT

Page 1: Android Development Basics

A.Mohammed Adam,

Activist on Free Software Foundation

Tamil Nadu,

.

Page 2: Android Development Basics

Various Mobile OS and its PlatformMobile Operating Systems OS Family

iOS Darwin

Android Linux

Firefox OS Linux

Windows Phone Windows CE & Windows NT

Black Berry OS QNX (UNIX like System)

Series 40 JAVA

Mer Linux

Tizen Linux

Sailfish OS Linux

Ubuntu Touch Linux

Page 3: Android Development Basics

1.What is Android???

1.Why Android???

1.What it do???

Page 4: Android Development Basics

ANDROID VERSION RELEASE DATE CODENAME

1.1 9 February 2009 Petit four

1.5 30 April 2009 Cupcake

1.6 15 September 2009 Donut

2.0/2.1 26 October 2009 Eclair

2.2 20 May 2010 Froyo

2.3 6 December 2010 Gingerbread

3.0/3.1/3.2 22 February 2011 Honeycomb

4.0 19 October 2011 Ice Cream Sandwich

4.2/4.3 27 June 2012 Jelly Bean

4.4 16 September 2013 Kit Kat

Page 5: Android Development Basics

Wh

at

Is A

nd

roid

?

Its an Operating System based on a Modified

Version of Linux.

Originally developed by a startup of the same

name, Android, Inc. in 2005.

Google wanted Android to be open and free;

hence most of the Android code was released

under the Open Source Apache License.

Page 6: Android Development Basics

Storage - Uses SQLite, a lightweight relational database, for data storage.

Connectivity - Supports GSM/EDGE, IDEN, CDMA, EV-DO, UMTS,

Bluetooth (includes A2DP and AVRCP), Wi-Fi, LTE, and WiMAX.

Messaging - Supports both SMS and MMS.

Web browser - Based on the open source WebKit, together with Chrome’s

Support

Media & Hardware support

Multi-touch & Multi-tasking

Flash support - android 2.3 supports Flash 10.1.

Tethering - Supports sharing of Internet Connections as a wired/wireless

hotspot.Fe

atu

res

of

An

dro

id

Page 7: Android Development Basics

An

dro

id A

rch

itectu

re

Page 8: Android Development Basics

Phone or AVD

Eclipse

(http://www.eclipse.org/downloads/)

Android Plugin (ADT)

Android SDK

(http://developer.android.com/sdk/index.h

tml)

Install everything except Additional

SDK Platforms, unless you want toRe

qu

ire

d T

oo

ls

Page 9: Android Development Basics

src - your source code

gen - auto-generated code

(usually just R.java)

Included libraries

Resources

Drawables (like .png images)

Layouts

Values (like strings)

Manifest file

Pro

jec

t C

om

po

nen

ts

Page 10: Android Development Basics

XM

LUsed to define some of the resources

Layouts (UI)

Strings

Manifest file

Shouldn't usually have to edit it directly, Eclipse

can do that for you

Preferred way of creating UI’s

Separates the description of the layout from any

actual code that controls it

Can easily take a UI from one platform to another

Page 11: Android Development Basics

R C

lass

Auto-generated: you shouldn't edit it

Contains IDs of the project resources

Enforces good software engineering

Use findViewById and Resources object to get

access to the resources

Ex. Button b = (Button) findViewById

(R.id.button1);

Ex. getResources().getString(R.string.hello));

Page 12: Android Development Basics

La

yo

uts

Eclipse has a great UI creator

Generates the XML for you

Composed of View objects

Can be specified for portrait and landscape

mode

Use same file name, so can make

completely different UIs for the orientations

without modifying any code

Page 13: Android Development Basics

Ma

nif

est

File

Contains characteristics about your application

When have more than one Activity in app, NEED

to specify it in manifest file

Go to graphical view of the manifest file

Add an Activity in the bottom right

Browse for the name of the activity

Need to specify Services and other components

too

Also important to define permissions and external

libraries, like Google Maps API

Page 14: Android Development Basics

Pro

gra

mm

ing

Co

mp

on

en

tsActivity

http://developer.android.com/guide/topics/fund

amentals/activities.html

Service

http://developer.android.com/guide/topics/fund

amentals/services.html

Content Providers

Broadcast Receivers

Page 15: Android Development Basics

He

llo

Wo

rld

!!!

Create new “Android Application Project” in Eclipse.

Page 16: Android Development Basics

He

llo

Wo

rld

!!!

Create new “Android Application Project” in Eclipse.

Page 17: Android Development Basics

He

llo

Wo

rld

!!!

Create new “Android Application Project” in Eclipse.

Page 18: Android Development Basics

He

llo

Wo

rld

!!!

Create new “Android Application Project” in Eclipse.

Page 19: Android Development Basics

He

llo

Wo

rld

!!!

Create new “Android Application Project” in Eclipse.

Page 20: Android Development Basics

He

llo

Wo

rld

!!!

Create new “Android Application Project” in Eclipse.

Page 21: Android Development Basics

He

llo

Wo

rld

!!!

Create new “Android Application Project” in Eclipse.

Page 22: Android Development Basics

He

llo

Wo

rld

!!!

Run your new Project!!!!

Page 23: Android Development Basics

He

llo

Wo

rld

!!!

Run your new Project!!!!

Page 24: Android Development Basics

Va

rio

us L

ayo

uts

Relative Layout

Linear Layout (Vertical)

Linear Layout (Horizontal)

Grid Layout

Frame Layout

Table Layout

Page 25: Android Development Basics

Rela

tiv

e L

ayo

ut

Structure:<RelativeLayout

xmlns:android="http://schemas.android.com/apk/r

es/android"

android:layout_width="match_parent"

android:layout_height="match_parent"

tools:context=“.MainActivity” >

<Button

android:id="@+id/button1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_alignParentTop="true"

android:text="Button" />

</RelativeLayout>

Page 26: Android Development Basics

Lin

ea

r L

ayo

ut

(Ho

rizo

nta

l)

Structure:<LinearLayout

xmlns:android="http://schemas.android.co

m

/apk/res/android"

android:layout_width="fill_parent"

android:layout_height="fill_parent" >

<Button

android:id="@+id/button1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Button" />

<TextView

android:id="@+id/textView1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Large Text" />

</LinearLayout>

Page 27: Android Development Basics

Lin

ea

r L

ayo

ut

(Ve

rtic

al)

Structure:<LinearLayout

xmlns:android="http://schemas.android.com/

apk/res/android"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="vertical" >

<Button

android:id="@+id/button1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Button" />

<TextView

android:id="@+id/textView1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="TextView" />

</LinearLayout>

Page 28: Android Development Basics

Gri

d L

ayo

ut

<GridLayout

xmlns:android="http://schemas.android.com/apk/res

/android"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:columnCount="2" >

<Button

android:id="@+id/button1"

android:layout_column="0"

android:layout_gravity="left|top"

android:layout_row="0"

android:text="Button" />

<EditText

android:id="@+id/editText1"

android:layout_width="323dp"

android:layout_column="0"

android:layout_gravity="right|bottom"

android:layout_row="0"

android:ems="10" />

</GridLayout>

Page 29: Android Development Basics
Page 30: Android Development Basics

Wo

rkin

g w

ith In

ten

t!!!Calling Built-In Applications Using Intents.Intent i = new Intent

(android.content.Intent.ACTION_VIEW,

Uri.parse(“http://www.amazon.com”));

startActivity(i);

To Make Call:

Intent i=new Intent

(android.content.Intent.ACTION_DIAL,Uri.parse(“tel:+918148308508));

To View Map:

Intent i=new Intent

(android.content.Intent.ACTION_VIEW,Uri.parse(“geo:12.25,79.30”));

Page 31: Android Development Basics

Mak

ing

To

ast

on

Sc

reen

Toast.makeText(getApplicationContext(),

"TestApplication",Toast.LENGTH_LONG).show();

Page 32: Android Development Basics

Pa

ss

ing

Va

lue

s t

o

an

oth

er

Acti

vit

y U

sin

g

Inte

nt

Ob

ject

Page 33: Android Development Basics
Page 34: Android Development Basics

Use this Layout…

Page 35: Android Development Basics

1.en.wikipedia.org/wiki/comparison_of_mobile_

operating_systems

2.en.wikipedia.org/wiki/list_of_custom_android

_firmware

3.developer.android.com/training/basics/firstap

p/starting-activity.html

4.http://stackoverflow.com/

5.http://www.wileyindia.com/

Page 36: Android Development Basics

Mail :

[email protected]

Facebook :

https://www.facebook.com/amd.adam.5