SlideShare a Scribd company logo
Slide 1 of 49© People Strategists www.peoplestrategists.com
Android Computing Platform
Slide 2 of 49© People Strategists www.peoplestrategists.com Slide 2 of 57© People Strategists www.peoplestrategists.com
Slide 3 of 49© People Strategists www.peoplestrategists.com
Android Introduction
• A Software platform and Linux Kernel based operating
system for mobile.
•Android is Open Source means it is made freely available and
may be redistributed and modified.
• Android was developed in 2003.
Slide 4 of 49© People Strategists www.peoplestrategists.com
History of Android
Slide 5 of 49© People Strategists www.peoplestrategists.com
Android Releases
Available from
November 3rd 2014
Slide 6 of 49© People Strategists www.peoplestrategists.com
Android Architecture
Slide 7 of 49© People Strategists www.peoplestrategists.com
Linux kernel
 This is the core layer of android architecture which provides services
like power management, memory management, security and binder for
process communication.
Android Architecture
Slide 8 of 49© People Strategists www.peoplestrategists.com
Native Libraries
 These libraries are written in C/C++ like web libraries to access web browser,
libraries for android video formats.
 Application framework access these libraries
Android Architecture
Slide 9 of 49© People Strategists www.peoplestrategists.com
Application Framework
The set of API's that allow developers to quickly and easily write android app and
they are written in a Java programming language.
Android Architecture
Slide 10 of 49© People Strategists www.peoplestrategists.com
Android Runtime
Takes very less time to launch an app,
More device Storage.
Note : Introduced in Kitkat version
Takes time to launch an app,
Less device storage
Note : Declared dead in Lollipop version
Slide 11 of 49© People Strategists www.peoplestrategists.com
Android Architecture
Slide 12 of 49© People Strategists www.peoplestrategists.com
Just 25$ for Registration.
https://play.google.com/apps
/publish/signup/
upload free/
paid apps.
Android App Market
Slide 13 of 49© People Strategists www.peoplestrategists.com
Android Target
Slide 14 of 49© People Strategists www.peoplestrategists.com
Setting Up your Android
Development Environment
Check System Requirements on below link:-
https://developer.android.com/sdk/index.html#Requirements
1. To develop applications for Android platform, you need
 Java SE Development Kit (JDK),
 Android SDK Integrated IDE (Android Studio)
2. Download the Android Studio
http://developer.android.com/sdk/index.html
Slide 15 of 49© People Strategists www.peoplestrategists.com
Understanding Project Structure
Slide 16 of 49© People Strategists www.peoplestrategists.com Slide 16 of 57© People Strategists www.peoplestrategists.com
Building Block,
User Interface and Controls
Slide 17 of 49© People Strategists www.peoplestrategists.com
Android Components
Activity
 Single screen in your application
Content Provider
 Can expose your data and have your applications use data from other
applications.
Slide 18 of 49© People Strategists www.peoplestrategists.com
Service
 Local services
 Remote services.
Broadcast Receiver
 Allows to register for system or application events
Android Components
Slide 19 of 49© People Strategists www.peoplestrategists.com
AndroidManifest.xml(Metadata of Android Application)
 It lists your application’s activities and services, along with the
permissions and features the application needs to run.
Syntax :
<manifest>
<Elements for Application properties should come here>
<application>
<Elements for application components should come here>
</application>
</manifest>
AndroidManifest
Slide 20 of 49© People Strategists www.peoplestrategists.com
Android Virtual Devices
 AVD allows developers to test their applications
AVD
Slide 21 of 49© People Strategists www.peoplestrategists.com
import android.app.Activity;
import android.os.Bundle;
public class HelloWorld extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
HelloWorld
Slide 22 of 49© People Strategists www.peoplestrategists.com
Android the Application Life
Cycle
Slide 23 of 49© People Strategists www.peoplestrategists.com
Android Resources
Compiled and Uncompiled Android Resources
• XML files
• Raw files
Slide 24 of 49© People Strategists www.peoplestrategists.com
String Resources
• Define strings in one or more
XML resource files.
• These XML files containing
string-resource definitions
reside in the /res/values
subdirectory.
strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">hello</string>
<string name="app_name">hello
appname</string>
</resources>
Android Resources
Slide 25 of 49© People Strategists www.peoplestrategists.com
Layout Resources
• A key resource used in
Android UI programming.
public class HelloWorldActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
...
}
Android Resources
Slide 26 of 49© People Strategists www.peoplestrategists.com
Example main.xml Layout File
<?xml version="1.0" encoding="utf-
8"?>
<LinearLayout
xmlns:android="http://schemas.andr
oid.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
Android Resources
Slide 27 of 49© People Strategists www.peoplestrategists.com
Color Resources
<resources>
<color name="red">#f00</color>
<color
name="blue">#0000ff</color>
<color
name="green">#f0f0</color>
<color
name="main_back_ground_color">
#ffffff00</color>
</resources>
Android Resources
Slide 28 of 49© People Strategists www.peoplestrategists.com
Color Resources in Java code
int mainBackGroundColor =
activity.getResources.getColor(R.color.main_back_ground_color);
Using Colors in View Definitions
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/red"
android:text="Sample Text to Show Red Color"/>
Android Resources
Slide 29 of 49© People Strategists www.peoplestrategists.com
Dimension Resources
You can specify the dimensions in any of the following units:
px: Pixels
in: Inches
mm: Millimeters
pt: Points
dp: Density-independent pixels based on pixel density per inch
sp: Scale-independent pixels (dimensions that allow for user sizing;
helpful for use in fonts)
Android Resources
Slide 30 of 49© People Strategists www.peoplestrategists.com
XML Syntax for Defining Dimension
Resources
<resources>
<dimen name="mysize_in_pixels">1px</dimen>
<dimen name="mysize_in_dp">5dp</dimen>
<dimen name="medium_size">100sp</dimen>
</resources>
Using Dimension Resources in XML
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/medium_size"/>
Android Resources
Slide 31 of 49© People Strategists www.peoplestrategists.com
Image Resources
Using Image Resources in XML
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Dial"
android:background="@drawable/sample_image"
/>
Android Resources
Slide 32 of 49© People Strategists www.peoplestrategists.com
Android Resources
package com.mycompany.android.my-root-package;
public final class R {
...other entries depending on your project and application
public static final class string
{
...other entries depending on your project and application
publicstaticfinal int hello=0x7f040000;
publicstaticfinal int app_name=0x7f040001;
...other entries depending on your project and application
}
...other entries depending on your project and application
}
• R.java with unique IDs for the
two string resources specified.
R.java
Slide 33 of 49© People Strategists www.peoplestrategists.com
Resource Reference Syntax
Android resources are identified (or referenced) by their IDs in Java source code.
<TextView android:id="@+id/text">
//Success: Creates an id called "text" in the local package's R.java
In the syntax "@+id/text", the + sign has a special meaning. It tells Android that the ID
text may not already exist
Android Resources
Slide 34 of 49© People Strategists www.peoplestrategists.com
Android
View and ViewGroup
Slide 35 of 49© People Strategists www.peoplestrategists.com
Buttons
Slide 36 of 49© People Strategists www.peoplestrategists.com
Basic Button
<Button android:id="@+id/button1"
android:text="@string/basicBtnLabel"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
……………………
ImageButton
<ImageButton android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="myClickHandler"
android:src="@drawable/icon" />
……………..
ImageButton imageButton2 =
(ImageButton)this.findViewById(R.id.imageButton2);
imageButton2.setImageResource(R.drawable.icon);
Buttons
Slide 37 of 49© People Strategists www.peoplestrategists.com
ToggleButton
<ToggleButton android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Toggle Button"
android:textOn="Stop"
android:textOff="Run"/>
Button button1 = (Button)this.findViewById(R.id.button1);
button1.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://www.androidbook.com"));
startActivity(intent);
}
});
Buttons
Slide 38 of 49© People Strategists www.peoplestrategists.com
CheckBox
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<CheckBox android:id="@+id/chickenCB"
android:text="Chicken" android:checked="true"
android:layout_width=“wrap_content"
android:layout_height="wrap_content" />
<CheckBox android:id="@+id/fishCB" android:text="Fish"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<CheckBox android:id="@+id/steakCB"
android:text="Steak" android:checked="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
CheckBox
Slide 39 of 49© People Strategists www.peoplestrategists.com
RadioButton
RadioButton
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RadioGroup android:id="@+id/rBtnGrp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RadioButton android:id="@+id/chRBtn"
android:text="Chicken"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
………………………..
</RadioGroup>
</LinearLayout>
Slide 40 of 49© People Strategists www.peoplestrategists.com
RadioButton
ImageView
<ImageView android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content“
android:src="@drawable/abc"
/>
Slide 41 of 49© People Strategists www.peoplestrategists.com
DatePicker
<DatePicker android:id="@+id/datePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
………………………..
DatePicker dp = (DatePicker)this.findViewById(R.id.datePicker);
dateDefault.setText("Date defaulted to " + (dp.getMonth() + 1) + "/" +
dp.getDayOfMonth() + "/" + dp.getYear());
dp.init(2008, 11, 10, null);
TimePicker
<TimePicker android:id="@+id/timePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
………………………..
TimePicker tp = (TimePicker)this.findViewById(R.id.timePicker);
tp.setIs24HourView(true);
tp.setCurrentHour(new Integer(10));
tp.setCurrentMinute(new Integer(10));
Pickers
Slide 42 of 49© People Strategists www.peoplestrategists.com
DigitalClock
<DigitalClock
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
AnalogClock
<AnalogClock
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Pickers
Slide 43 of 49© People Strategists www.peoplestrategists.com
ListView
<ListView android:id="@+id/list"
android:layout_width=" wrap_content "
android:layout_height=" wrap_content "
android:entries=“@array/mylist” />
List
Slide 44 of 49© People Strategists www.peoplestrategists.com
Layout Manager
Layout Manager Description
LinearLayout Organizes its children either horizontally or vertically
TableLayout Organizes its children in tabular form
RelativeLayout Organizes its children relative to one another or to
the parent
FrameLayout Allows you to dynamically changethe control(s) in
the layout
Slide 45 of 49© People Strategists www.peoplestrategists.com
Layout Manager
LinearLayout
<LinearLayout
xmlns:android="http://schemas.android.com/a
pk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!—add components-->
</LinearLayout>
Slide 46 of 49© People Strategists www.peoplestrategists.com
Layout Manager
RelativeLayout
<RelativeLayout …………… >
<TextView android:id="@+id/userNameLbl"
android:text="Username: “
android:layout_alignParentTop="true" />
<EditText android:id="@+id/userNameText"
android:layout_toRightOf="@id/userNameLbl" />
<TextView android:id="@+id/pwdLbl"
android:layout_below="@id/userNameText"
android:text="Password: " />
<EditText android:id="@+id/pwdText"
android:layout_toRightOf="@id/pwdLbl"
android:layout_below="@id/userNameText" />
<TextView android:id="@+id/pwdCriteria"
android:layout_below="@id/pwdText"
android:text="Password Criteria... " />
</RelativeLayout>
Slide 47 of 49© People Strategists www.peoplestrategists.com
TableLayout
<TableLayout ……… >
<TableRow>
<TextView android:text="First Name:“
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText android:text="Edgar“
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow>
<TextView android:text="Last Name:"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText android:text="Poe"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
Layout Manager
Slide 48 of 49© People Strategists www.peoplestrategists.com
Layout Manager
FrameLayout
<FrameLayout android:id="@+id/frmLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/oneImgView"
android:src="@drawable/one"
android:scaleType="fitCenter"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<ImageView
android:id="@+id/twoImgView"
android:src="@drawable/two"
android:scaleType="fitCenter"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone" />
</FrameLayout>
Slide 49 of 49© People Strategists www.peoplestrategists.com
Styles
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name=“SpelError">
<item
name="android:layout_width">fill_parent</item>
<item
name="android:layout_height">wrap_content</item>
<item name="android:textColor">#FF0000</item>
<item
name="android:typeface">monospace</item>
</style>
</resources>
………………..
<TextView android:id="@+id/errorText"
style="@style/ SpelError"
android:text=“Styling”
/>
Styles
Slide 50 of 49© People Strategists www.peoplestrategists.com
Themes
If you have some style elements you want applied across an entire activity, or across
the whole application, you should use a theme instead. A theme is it’s exactly like a
style. To specify a theme for an activity or an application, we would add an attribute
to the <activity>or <application>tag in the AndroidManifest.xml.
<activity android:theme="@style/MyActivityTheme">
<application android:theme="@style/MyApplicationTheme">
Themes
Slide 51 of 49© People Strategists www.peoplestrategists.com Slide 51 of 57© People Strategists www.peoplestrategists.com
Slide 52 of 49© People Strategists www.peoplestrategists.com
Intent
A mechanism to communicate from one component to another.
It defines intention of an application and also used to transfer
data.
An Intent mainly can be used :-
 To start an activity or service.
 To transfer data etc.
Slide 53 of 49© People Strategists www.peoplestrategists.com
Intent
Types of Intents:-
 Implicit
Slide 54 of 49© People Strategists www.peoplestrategists.com
Intents
 Explicit
Slide 55 of 49© People Strategists www.peoplestrategists.com
Built-in Intent Actions
Intent
Slide 56 of 49© People Strategists www.peoplestrategists.com
Data Passing
An intent can include an additional attribute called extras which
can be used to pass data.
This extra information is represented by an Android class called
android.os.Bundle.
// Place a bundle in an intent
Bundle anotherBundle = new Bundle();
//populate the bundle with key/value pairs
//and then set the bundle on the Intent
intent.putExtras(anotherBundle);
//Get the Bundle from an Intent
Bundle extraBundle = intent.getExtras();
Slide 57 of 49© People Strategists www.peoplestrategists.com
Data Passing
You can use a number of methods to add fundamental types to
the bundle.
putExtra(String name, boolean value);
putExtra(String name, int value);
putExtra(String name, double value);
putExtra(String name, String value);

More Related Content

What's hot

Liferay Platform Overview
Liferay Platform OverviewLiferay Platform Overview
Liferay Platform Overview
FirmansyahIrma1
 
java web framework standard.20180412
java web framework standard.20180412java web framework standard.20180412
java web framework standard.20180412
FirmansyahIrma1
 
MicroStrategy interoperability with Greenplum
MicroStrategy interoperability with GreenplumMicroStrategy interoperability with Greenplum
MicroStrategy interoperability with Greenplum
BiBoard.Org
 
World 2013 - Pushing MicroStrategy to the Limit, The Hacker Way
World 2013 - Pushing MicroStrategy to the Limit, The Hacker WayWorld 2013 - Pushing MicroStrategy to the Limit, The Hacker Way
World 2013 - Pushing MicroStrategy to the Limit, The Hacker Way
Bryan Brandow
 
Solution-Architectures-MADP-20180125
Solution-Architectures-MADP-20180125Solution-Architectures-MADP-20180125
Solution-Architectures-MADP-20180125
FirmansyahIrma1
 
Oracle Big Data Jam Session #1 - オラクルのビッグデータ系サーバレス・サービスのポートフォリオ
Oracle Big Data Jam Session #1 - オラクルのビッグデータ系サーバレス・サービスのポートフォリオOracle Big Data Jam Session #1 - オラクルのビッグデータ系サーバレス・サービスのポートフォリオ
Oracle Big Data Jam Session #1 - オラクルのビッグデータ系サーバレス・サービスのポートフォリオ
オラクルエンジニア通信
 

What's hot (9)

Hibernate II
Hibernate IIHibernate II
Hibernate II
 
Liferay Platform Overview
Liferay Platform OverviewLiferay Platform Overview
Liferay Platform Overview
 
Spring Framework -I
Spring Framework -ISpring Framework -I
Spring Framework -I
 
java web framework standard.20180412
java web framework standard.20180412java web framework standard.20180412
java web framework standard.20180412
 
MicroStrategy interoperability with Greenplum
MicroStrategy interoperability with GreenplumMicroStrategy interoperability with Greenplum
MicroStrategy interoperability with Greenplum
 
World 2013 - Pushing MicroStrategy to the Limit, The Hacker Way
World 2013 - Pushing MicroStrategy to the Limit, The Hacker WayWorld 2013 - Pushing MicroStrategy to the Limit, The Hacker Way
World 2013 - Pushing MicroStrategy to the Limit, The Hacker Way
 
Solution-Architectures-MADP-20180125
Solution-Architectures-MADP-20180125Solution-Architectures-MADP-20180125
Solution-Architectures-MADP-20180125
 
Oracle Big Data Jam Session #1 - オラクルのビッグデータ系サーバレス・サービスのポートフォリオ
Oracle Big Data Jam Session #1 - オラクルのビッグデータ系サーバレス・サービスのポートフォリオOracle Big Data Jam Session #1 - オラクルのビッグデータ系サーバレス・サービスのポートフォリオ
Oracle Big Data Jam Session #1 - オラクルのビッグデータ系サーバレス・サービスのポートフォリオ
 
MadhavG
MadhavGMadhavG
MadhavG
 

Viewers also liked

Pharma
PharmaPharma
Pharma
nisha192
 
Chinese new Year 2014
Chinese new Year 2014Chinese new Year 2014
Chinese new Year 2014
matthgr
 
Mithun Pavithran Mechanical QAQC Engineer 1
Mithun Pavithran Mechanical QAQC Engineer 1Mithun Pavithran Mechanical QAQC Engineer 1
Mithun Pavithran Mechanical QAQC Engineer 1Mithun Pavithran
 
Česká pojišťovna 2012
Česká pojišťovna 2012Česká pojišťovna 2012
Česká pojišťovna 2012JaroslavPokorny
 
Prensa hidráulica calefactora para industria de guadua
Prensa hidráulica calefactora para industria de guaduaPrensa hidráulica calefactora para industria de guadua
Prensa hidráulica calefactora para industria de guadua
Festival Internacional del Bambú
 
Desktop publishing (dtp)
Desktop publishing (dtp)Desktop publishing (dtp)
Desktop publishing (dtp)
Vidya Typing
 
Cohesive Decentralization - THNK School of Creative Leadership
Cohesive Decentralization - THNK School of Creative LeadershipCohesive Decentralization - THNK School of Creative Leadership
Cohesive Decentralization - THNK School of Creative Leadership
THNK School of Creative Leadership
 

Viewers also liked (10)

A Marketable Leader
A Marketable LeaderA Marketable Leader
A Marketable Leader
 
Pharma
PharmaPharma
Pharma
 
Chinese new Year 2014
Chinese new Year 2014Chinese new Year 2014
Chinese new Year 2014
 
Mithun Pavithran Mechanical QAQC Engineer 1
Mithun Pavithran Mechanical QAQC Engineer 1Mithun Pavithran Mechanical QAQC Engineer 1
Mithun Pavithran Mechanical QAQC Engineer 1
 
TalkTV-2016
TalkTV-2016TalkTV-2016
TalkTV-2016
 
Česká pojišťovna 2012
Česká pojišťovna 2012Česká pojišťovna 2012
Česká pojišťovna 2012
 
Prensa hidráulica calefactora para industria de guadua
Prensa hidráulica calefactora para industria de guaduaPrensa hidráulica calefactora para industria de guadua
Prensa hidráulica calefactora para industria de guadua
 
Desktop publishing (dtp)
Desktop publishing (dtp)Desktop publishing (dtp)
Desktop publishing (dtp)
 
Cohesive Decentralization - THNK School of Creative Leadership
Cohesive Decentralization - THNK School of Creative LeadershipCohesive Decentralization - THNK School of Creative Leadership
Cohesive Decentralization - THNK School of Creative Leadership
 
M&A in Pharma
M&A in PharmaM&A in Pharma
M&A in Pharma
 

Similar to Android - Day 1

Matteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break editionMatteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break editionDuckMa
 
Android Applications Development: A Quick Start Guide
Android Applications Development: A Quick Start GuideAndroid Applications Development: A Quick Start Guide
Android Applications Development: A Quick Start Guide
Sergii Zhuk
 
Android Jump Start
Android Jump StartAndroid Jump Start
Android Jump Start
Haim Michael
 
Android - Open Source Bridge 2011
Android - Open Source Bridge 2011Android - Open Source Bridge 2011
Android - Open Source Bridge 2011
sullis
 
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
DuckMa
 
Android presentation slide
Android presentation slideAndroid presentation slide
Android presentation slide
APSMIND TECHNOLOGY PVT LTD.
 
Android TCJUG
Android TCJUGAndroid TCJUG
Android TCJUG
Justin Grammens
 
Android development training programme Day 1
Android development training programme Day 1Android development training programme Day 1
Android development training programme Day 1DHIRAJ PRAVIN
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development Practices
Roy Clarkson
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011
sullis
 
Android For Java Developers
Android For Java DevelopersAndroid For Java Developers
Android For Java Developers
Mike Wolfson
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
lzongren
 
Android - From Zero to Hero @ DEVit 2017
Android - From Zero to Hero @ DEVit 2017Android - From Zero to Hero @ DEVit 2017
Android - From Zero to Hero @ DEVit 2017
Ivo Neskovic
 
Phonebook Directory or Address Book In Android
Phonebook Directory or Address Book In AndroidPhonebook Directory or Address Book In Android
Phonebook Directory or Address Book In Android
ABHISHEK DINKAR
 
Seminar on android app development
Seminar on android app developmentSeminar on android app development
Seminar on android app development
AbhishekKumar4779
 
Automated Historical Performance Analysis with kmemtracer
Automated Historical Performance Analysis with kmemtracerAutomated Historical Performance Analysis with kmemtracer
Automated Historical Performance Analysis with kmemtracer
Kyungmin Lee
 
Lecture 05. UI programming for Mobile Apps
Lecture 05. UI programming for Mobile AppsLecture 05. UI programming for Mobile Apps
Lecture 05. UI programming for Mobile Apps
Maksym Davydov
 
Android Minnebar
Android MinnebarAndroid Minnebar
Android Minnebar
Justin Grammens
 
Android Development : (Android Studio, PHP, XML, MySQL)
Android Development : (Android Studio, PHP, XML, MySQL)Android Development : (Android Studio, PHP, XML, MySQL)
Android Development : (Android Studio, PHP, XML, MySQL)
Kavya Barnadhya Hazarika
 
Mobile Application Development
Mobile Application DevelopmentMobile Application Development
Mobile Application Development
AbelRobel
 

Similar to Android - Day 1 (20)

Matteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break editionMatteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break edition
 
Android Applications Development: A Quick Start Guide
Android Applications Development: A Quick Start GuideAndroid Applications Development: A Quick Start Guide
Android Applications Development: A Quick Start Guide
 
Android Jump Start
Android Jump StartAndroid Jump Start
Android Jump Start
 
Android - Open Source Bridge 2011
Android - Open Source Bridge 2011Android - Open Source Bridge 2011
Android - Open Source Bridge 2011
 
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
 
Android presentation slide
Android presentation slideAndroid presentation slide
Android presentation slide
 
Android TCJUG
Android TCJUGAndroid TCJUG
Android TCJUG
 
Android development training programme Day 1
Android development training programme Day 1Android development training programme Day 1
Android development training programme Day 1
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development Practices
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011
 
Android For Java Developers
Android For Java DevelopersAndroid For Java Developers
Android For Java Developers
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
Android - From Zero to Hero @ DEVit 2017
Android - From Zero to Hero @ DEVit 2017Android - From Zero to Hero @ DEVit 2017
Android - From Zero to Hero @ DEVit 2017
 
Phonebook Directory or Address Book In Android
Phonebook Directory or Address Book In AndroidPhonebook Directory or Address Book In Android
Phonebook Directory or Address Book In Android
 
Seminar on android app development
Seminar on android app developmentSeminar on android app development
Seminar on android app development
 
Automated Historical Performance Analysis with kmemtracer
Automated Historical Performance Analysis with kmemtracerAutomated Historical Performance Analysis with kmemtracer
Automated Historical Performance Analysis with kmemtracer
 
Lecture 05. UI programming for Mobile Apps
Lecture 05. UI programming for Mobile AppsLecture 05. UI programming for Mobile Apps
Lecture 05. UI programming for Mobile Apps
 
Android Minnebar
Android MinnebarAndroid Minnebar
Android Minnebar
 
Android Development : (Android Studio, PHP, XML, MySQL)
Android Development : (Android Studio, PHP, XML, MySQL)Android Development : (Android Studio, PHP, XML, MySQL)
Android Development : (Android Studio, PHP, XML, MySQL)
 
Mobile Application Development
Mobile Application DevelopmentMobile Application Development
Mobile Application Development
 

More from People Strategists (20)

MongoDB Session 3
MongoDB Session 3MongoDB Session 3
MongoDB Session 3
 
MongoDB Session 1
MongoDB Session 1MongoDB Session 1
MongoDB Session 1
 
Overview of web services
Overview of web servicesOverview of web services
Overview of web services
 
Hibernate III
Hibernate IIIHibernate III
Hibernate III
 
Hibernate I
Hibernate IHibernate I
Hibernate I
 
Identifing Listeners and Filters
Identifing Listeners and FiltersIdentifing Listeners and Filters
Identifing Listeners and Filters
 
Exploring Maven SVN GIT
Exploring Maven SVN GITExploring Maven SVN GIT
Exploring Maven SVN GIT
 
Agile Dev. II
Agile Dev. IIAgile Dev. II
Agile Dev. II
 
Agile Dev. I
Agile Dev. IAgile Dev. I
Agile Dev. I
 
Working with Servlets
Working with ServletsWorking with Servlets
Working with Servlets
 
JSP Technology II
JSP Technology IIJSP Technology II
JSP Technology II
 
JSP Technology I
JSP Technology IJSP Technology I
JSP Technology I
 
XML Schemas
XML SchemasXML Schemas
XML Schemas
 
JSON and XML
JSON and XMLJSON and XML
JSON and XML
 
Ajax and Jquery
Ajax and JqueryAjax and Jquery
Ajax and Jquery
 
CSS
CSSCSS
CSS
 
HTML/HTML5
HTML/HTML5HTML/HTML5
HTML/HTML5
 
JDBC
JDBCJDBC
JDBC
 
RDBMS with MySQL
RDBMS with MySQLRDBMS with MySQL
RDBMS with MySQL
 
Java Day-7
Java Day-7Java Day-7
Java Day-7
 

Recently uploaded

FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 

Android - Day 1

  • 1. Slide 1 of 49© People Strategists www.peoplestrategists.com Android Computing Platform
  • 2. Slide 2 of 49© People Strategists www.peoplestrategists.com Slide 2 of 57© People Strategists www.peoplestrategists.com
  • 3. Slide 3 of 49© People Strategists www.peoplestrategists.com Android Introduction • A Software platform and Linux Kernel based operating system for mobile. •Android is Open Source means it is made freely available and may be redistributed and modified. • Android was developed in 2003.
  • 4. Slide 4 of 49© People Strategists www.peoplestrategists.com History of Android
  • 5. Slide 5 of 49© People Strategists www.peoplestrategists.com Android Releases Available from November 3rd 2014
  • 6. Slide 6 of 49© People Strategists www.peoplestrategists.com Android Architecture
  • 7. Slide 7 of 49© People Strategists www.peoplestrategists.com Linux kernel  This is the core layer of android architecture which provides services like power management, memory management, security and binder for process communication. Android Architecture
  • 8. Slide 8 of 49© People Strategists www.peoplestrategists.com Native Libraries  These libraries are written in C/C++ like web libraries to access web browser, libraries for android video formats.  Application framework access these libraries Android Architecture
  • 9. Slide 9 of 49© People Strategists www.peoplestrategists.com Application Framework The set of API's that allow developers to quickly and easily write android app and they are written in a Java programming language. Android Architecture
  • 10. Slide 10 of 49© People Strategists www.peoplestrategists.com Android Runtime Takes very less time to launch an app, More device Storage. Note : Introduced in Kitkat version Takes time to launch an app, Less device storage Note : Declared dead in Lollipop version
  • 11. Slide 11 of 49© People Strategists www.peoplestrategists.com Android Architecture
  • 12. Slide 12 of 49© People Strategists www.peoplestrategists.com Just 25$ for Registration. https://play.google.com/apps /publish/signup/ upload free/ paid apps. Android App Market
  • 13. Slide 13 of 49© People Strategists www.peoplestrategists.com Android Target
  • 14. Slide 14 of 49© People Strategists www.peoplestrategists.com Setting Up your Android Development Environment Check System Requirements on below link:- https://developer.android.com/sdk/index.html#Requirements 1. To develop applications for Android platform, you need  Java SE Development Kit (JDK),  Android SDK Integrated IDE (Android Studio) 2. Download the Android Studio http://developer.android.com/sdk/index.html
  • 15. Slide 15 of 49© People Strategists www.peoplestrategists.com Understanding Project Structure
  • 16. Slide 16 of 49© People Strategists www.peoplestrategists.com Slide 16 of 57© People Strategists www.peoplestrategists.com Building Block, User Interface and Controls
  • 17. Slide 17 of 49© People Strategists www.peoplestrategists.com Android Components Activity  Single screen in your application Content Provider  Can expose your data and have your applications use data from other applications.
  • 18. Slide 18 of 49© People Strategists www.peoplestrategists.com Service  Local services  Remote services. Broadcast Receiver  Allows to register for system or application events Android Components
  • 19. Slide 19 of 49© People Strategists www.peoplestrategists.com AndroidManifest.xml(Metadata of Android Application)  It lists your application’s activities and services, along with the permissions and features the application needs to run. Syntax : <manifest> <Elements for Application properties should come here> <application> <Elements for application components should come here> </application> </manifest> AndroidManifest
  • 20. Slide 20 of 49© People Strategists www.peoplestrategists.com Android Virtual Devices  AVD allows developers to test their applications AVD
  • 21. Slide 21 of 49© People Strategists www.peoplestrategists.com import android.app.Activity; import android.os.Bundle; public class HelloWorld extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } HelloWorld
  • 22. Slide 22 of 49© People Strategists www.peoplestrategists.com Android the Application Life Cycle
  • 23. Slide 23 of 49© People Strategists www.peoplestrategists.com Android Resources Compiled and Uncompiled Android Resources • XML files • Raw files
  • 24. Slide 24 of 49© People Strategists www.peoplestrategists.com String Resources • Define strings in one or more XML resource files. • These XML files containing string-resource definitions reside in the /res/values subdirectory. strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello">hello</string> <string name="app_name">hello appname</string> </resources> Android Resources
  • 25. Slide 25 of 49© People Strategists www.peoplestrategists.com Layout Resources • A key resource used in Android UI programming. public class HelloWorldActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } ... } Android Resources
  • 26. Slide 26 of 49© People Strategists www.peoplestrategists.com Example main.xml Layout File <?xml version="1.0" encoding="utf- 8"?> <LinearLayout xmlns:android="http://schemas.andr oid.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > </LinearLayout> Android Resources
  • 27. Slide 27 of 49© People Strategists www.peoplestrategists.com Color Resources <resources> <color name="red">#f00</color> <color name="blue">#0000ff</color> <color name="green">#f0f0</color> <color name="main_back_ground_color"> #ffffff00</color> </resources> Android Resources
  • 28. Slide 28 of 49© People Strategists www.peoplestrategists.com Color Resources in Java code int mainBackGroundColor = activity.getResources.getColor(R.color.main_back_ground_color); Using Colors in View Definitions <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="@color/red" android:text="Sample Text to Show Red Color"/> Android Resources
  • 29. Slide 29 of 49© People Strategists www.peoplestrategists.com Dimension Resources You can specify the dimensions in any of the following units: px: Pixels in: Inches mm: Millimeters pt: Points dp: Density-independent pixels based on pixel density per inch sp: Scale-independent pixels (dimensions that allow for user sizing; helpful for use in fonts) Android Resources
  • 30. Slide 30 of 49© People Strategists www.peoplestrategists.com XML Syntax for Defining Dimension Resources <resources> <dimen name="mysize_in_pixels">1px</dimen> <dimen name="mysize_in_dp">5dp</dimen> <dimen name="medium_size">100sp</dimen> </resources> Using Dimension Resources in XML <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="@dimen/medium_size"/> Android Resources
  • 31. Slide 31 of 49© People Strategists www.peoplestrategists.com Image Resources Using Image Resources in XML <Button android:id="@+id/button1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Dial" android:background="@drawable/sample_image" /> Android Resources
  • 32. Slide 32 of 49© People Strategists www.peoplestrategists.com Android Resources package com.mycompany.android.my-root-package; public final class R { ...other entries depending on your project and application public static final class string { ...other entries depending on your project and application publicstaticfinal int hello=0x7f040000; publicstaticfinal int app_name=0x7f040001; ...other entries depending on your project and application } ...other entries depending on your project and application } • R.java with unique IDs for the two string resources specified. R.java
  • 33. Slide 33 of 49© People Strategists www.peoplestrategists.com Resource Reference Syntax Android resources are identified (or referenced) by their IDs in Java source code. <TextView android:id="@+id/text"> //Success: Creates an id called "text" in the local package's R.java In the syntax "@+id/text", the + sign has a special meaning. It tells Android that the ID text may not already exist Android Resources
  • 34. Slide 34 of 49© People Strategists www.peoplestrategists.com Android View and ViewGroup
  • 35. Slide 35 of 49© People Strategists www.peoplestrategists.com Buttons
  • 36. Slide 36 of 49© People Strategists www.peoplestrategists.com Basic Button <Button android:id="@+id/button1" android:text="@string/basicBtnLabel" android:layout_width="fill_parent" android:layout_height="wrap_content" /> …………………… ImageButton <ImageButton android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="myClickHandler" android:src="@drawable/icon" /> …………….. ImageButton imageButton2 = (ImageButton)this.findViewById(R.id.imageButton2); imageButton2.setImageResource(R.drawable.icon); Buttons
  • 37. Slide 37 of 49© People Strategists www.peoplestrategists.com ToggleButton <ToggleButton android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Toggle Button" android:textOn="Stop" android:textOff="Run"/> Button button1 = (Button)this.findViewById(R.id.button1); button1.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.androidbook.com")); startActivity(intent); } }); Buttons
  • 38. Slide 38 of 49© People Strategists www.peoplestrategists.com CheckBox <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <CheckBox android:id="@+id/chickenCB" android:text="Chicken" android:checked="true" android:layout_width=“wrap_content" android:layout_height="wrap_content" /> <CheckBox android:id="@+id/fishCB" android:text="Fish" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <CheckBox android:id="@+id/steakCB" android:text="Steak" android:checked="true" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> CheckBox
  • 39. Slide 39 of 49© People Strategists www.peoplestrategists.com RadioButton RadioButton <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <RadioGroup android:id="@+id/rBtnGrp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <RadioButton android:id="@+id/chRBtn" android:text="Chicken" android:layout_width="wrap_content" android:layout_height="wrap_content"/> ……………………….. </RadioGroup> </LinearLayout>
  • 40. Slide 40 of 49© People Strategists www.peoplestrategists.com RadioButton ImageView <ImageView android:id="@+id/img" android:layout_width="wrap_content" android:layout_height="wrap_content“ android:src="@drawable/abc" />
  • 41. Slide 41 of 49© People Strategists www.peoplestrategists.com DatePicker <DatePicker android:id="@+id/datePicker" android:layout_width="wrap_content" android:layout_height="wrap_content" /> ……………………….. DatePicker dp = (DatePicker)this.findViewById(R.id.datePicker); dateDefault.setText("Date defaulted to " + (dp.getMonth() + 1) + "/" + dp.getDayOfMonth() + "/" + dp.getYear()); dp.init(2008, 11, 10, null); TimePicker <TimePicker android:id="@+id/timePicker" android:layout_width="wrap_content" android:layout_height="wrap_content" /> ……………………….. TimePicker tp = (TimePicker)this.findViewById(R.id.timePicker); tp.setIs24HourView(true); tp.setCurrentHour(new Integer(10)); tp.setCurrentMinute(new Integer(10)); Pickers
  • 42. Slide 42 of 49© People Strategists www.peoplestrategists.com DigitalClock <DigitalClock android:layout_width="wrap_content" android:layout_height="wrap_content" /> AnalogClock <AnalogClock android:layout_width="wrap_content" android:layout_height="wrap_content" /> Pickers
  • 43. Slide 43 of 49© People Strategists www.peoplestrategists.com ListView <ListView android:id="@+id/list" android:layout_width=" wrap_content " android:layout_height=" wrap_content " android:entries=“@array/mylist” /> List
  • 44. Slide 44 of 49© People Strategists www.peoplestrategists.com Layout Manager Layout Manager Description LinearLayout Organizes its children either horizontally or vertically TableLayout Organizes its children in tabular form RelativeLayout Organizes its children relative to one another or to the parent FrameLayout Allows you to dynamically changethe control(s) in the layout
  • 45. Slide 45 of 49© People Strategists www.peoplestrategists.com Layout Manager LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/a pk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <!—add components--> </LinearLayout>
  • 46. Slide 46 of 49© People Strategists www.peoplestrategists.com Layout Manager RelativeLayout <RelativeLayout …………… > <TextView android:id="@+id/userNameLbl" android:text="Username: “ android:layout_alignParentTop="true" /> <EditText android:id="@+id/userNameText" android:layout_toRightOf="@id/userNameLbl" /> <TextView android:id="@+id/pwdLbl" android:layout_below="@id/userNameText" android:text="Password: " /> <EditText android:id="@+id/pwdText" android:layout_toRightOf="@id/pwdLbl" android:layout_below="@id/userNameText" /> <TextView android:id="@+id/pwdCriteria" android:layout_below="@id/pwdText" android:text="Password Criteria... " /> </RelativeLayout>
  • 47. Slide 47 of 49© People Strategists www.peoplestrategists.com TableLayout <TableLayout ……… > <TableRow> <TextView android:text="First Name:“ android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:text="Edgar“ android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> <TableRow> <TextView android:text="Last Name:" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:text="Poe" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> </TableLayout> Layout Manager
  • 48. Slide 48 of 49© People Strategists www.peoplestrategists.com Layout Manager FrameLayout <FrameLayout android:id="@+id/frmLayout" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/oneImgView" android:src="@drawable/one" android:scaleType="fitCenter" android:layout_width="fill_parent" android:layout_height="fill_parent"/> <ImageView android:id="@+id/twoImgView" android:src="@drawable/two" android:scaleType="fitCenter" android:layout_width="fill_parent" android:layout_height="fill_parent" android:visibility="gone" /> </FrameLayout>
  • 49. Slide 49 of 49© People Strategists www.peoplestrategists.com Styles <?xml version="1.0" encoding="utf-8"?> <resources> <style name=“SpelError"> <item name="android:layout_width">fill_parent</item> <item name="android:layout_height">wrap_content</item> <item name="android:textColor">#FF0000</item> <item name="android:typeface">monospace</item> </style> </resources> ……………….. <TextView android:id="@+id/errorText" style="@style/ SpelError" android:text=“Styling” /> Styles
  • 50. Slide 50 of 49© People Strategists www.peoplestrategists.com Themes If you have some style elements you want applied across an entire activity, or across the whole application, you should use a theme instead. A theme is it’s exactly like a style. To specify a theme for an activity or an application, we would add an attribute to the <activity>or <application>tag in the AndroidManifest.xml. <activity android:theme="@style/MyActivityTheme"> <application android:theme="@style/MyApplicationTheme"> Themes
  • 51. Slide 51 of 49© People Strategists www.peoplestrategists.com Slide 51 of 57© People Strategists www.peoplestrategists.com
  • 52. Slide 52 of 49© People Strategists www.peoplestrategists.com Intent A mechanism to communicate from one component to another. It defines intention of an application and also used to transfer data. An Intent mainly can be used :-  To start an activity or service.  To transfer data etc.
  • 53. Slide 53 of 49© People Strategists www.peoplestrategists.com Intent Types of Intents:-  Implicit
  • 54. Slide 54 of 49© People Strategists www.peoplestrategists.com Intents  Explicit
  • 55. Slide 55 of 49© People Strategists www.peoplestrategists.com Built-in Intent Actions Intent
  • 56. Slide 56 of 49© People Strategists www.peoplestrategists.com Data Passing An intent can include an additional attribute called extras which can be used to pass data. This extra information is represented by an Android class called android.os.Bundle. // Place a bundle in an intent Bundle anotherBundle = new Bundle(); //populate the bundle with key/value pairs //and then set the bundle on the Intent intent.putExtras(anotherBundle); //Get the Bundle from an Intent Bundle extraBundle = intent.getExtras();
  • 57. Slide 57 of 49© People Strategists www.peoplestrategists.com Data Passing You can use a number of methods to add fundamental types to the bundle. putExtra(String name, boolean value); putExtra(String name, int value); putExtra(String name, double value); putExtra(String name, String value);