SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Downloaden Sie, um offline zu lesen
HELLO
WE MEET AGAIN 
Android System
Architecture
Android is built on top of Linux kernel.
Android is built on top of Linux kernel.
Android uses a number of libraries to perform various functionalities.
Android is built on top of Linux kernel.
Android uses a number of libraries to perform various functionalities.
Just like the Java Virtual Machine in our computers, Android has its
own Dalvik Virtual Machine optimized for itself.
Android is built on top of Linux kernel.
Android uses a number of libraries to perform various functionalities.
Just like the Java Virtual Machine in our computers, Android has its
own Dalvik Virtual Machine optimized for itself.
Higher-level services to applications in the form of Java classes:
Application Framework.
Android is built on top of Linux kernel.
Android uses a number of libraries to perform various functionalities.
Just like the Java Virtual Machine in our computers, Android has its
own Dalvik Virtual Machine optimized for itself.
Higher-level services to applications in the form of Java classes:
Application Framework.
We will write applications to be installed on the Application layer only.
Introduction to

xml	
  
Android’s defined tags

Introduction to

xml	
  

Used to define some of
the resources
-  Layouts
-  Strings
Used in Android
Manifest
Preferred way for
defining UI elements
-  Separation of
code
Simple UI
LO
AU
YT

Eclipse has a great UI creator
-  Generates all the xml for you
Composed of View objects

Can be specified for portrait or
landscape
-  Different designs for different
orientation.
VIEWS
A layout/activity is composed of
Views and ViewGroups.
View is something that is visible.
Examples:
- 
- 
- 
- 

TextViews,
Buttons,
TimePicker,
DatePicker
VIEWS
3 ways to declare width and height

a. 
b. 
c. 

fill_parent
wrap_content
match_parent

<Button
android:id = “@+id/button”
android:layout_width = “fill_parent”
android:layout_height = “wrap_content”
android:text = “Button”/>

{

DO NOT FORGET

TO DEFINE US
VIEWS

{

<EditText
android:id = “@+id/number”
android:layout_width = “fill_parent”
android:layout_height = “wrap_content”
android:text = “number”/>

You can change
the type of
inputs as
necessary
VIEWS

<TextView
android:id = “@+id/result”
android:layout_height = “wrap_parent”
android:layout_weight = “fill_content”
android:text = “invisible”/>

3 ways to declare visibility

a. 
b. 
c. 

visible
invisible
gone
FrameLayout

4

One or more View can be
grouped into a ViewGroup

RelativeLayout

3

This is the <body> to your
view.

LinearLayout

2

ViewGroups

1

TableLayout

5

ScrollView, etc.
Each layout has something
unique to it.
Each layout has a purpose!
LinearLayout
Declaring the XML namespace (done
in the 1st ViewGroup)

<LinearLayout
xmlns:android=“http://schemas.android.com/apk/res/
android”
android:layout_width= “match_parent”
android:layout_height= “match_parent”
android:orientation= “vertical”>
… (TextViews, Buttons etc.)
</LinearLayout>
Unique for this ViewGroup
a.  Vertical
b.  Horizontal
RelativeLayout

Does not have any android:orientation.

Affects the layouts inside it

Views are arranged according to references.
RelativeLayout

<RelativeLayout ..>
<Button android:id= “@+id/btn”
android:layout_alignParentTop= "true" … />
<TextView android:layout_below = “@id/btn” … />
<TextView android:layout_toRightOf = “@id/btn” …/>
<TextView android:layout_toLeftOf = “@id/btn” …/>
<TextView android:layout_alignParentBottom =
“true” .../>
</RelativeLayout>
Various other positioning
techniques also there:
alignLeft
alignBaseLine
above, etc.
LinearLayout

vs

RelativeLayout
LETS UNITE!
<LinearLayout … >
<RelativeLayout … >
…
</RelativeLayout>
</LinearLayout>
You can use ViewGroup within ViewGroup

LAYOUTCEPTION!
INTENTS
ENTS

<a href= “target”>page 2</a>

Intent ~ Redirecting !

Intent is used to call into android's drivers,
other applications as well.

Powerful inter/intra application messagepassing framework.

While working with intents we also have to
work with the

Android Manifest
Android Manifest
Presents essential information
about the application to the
Android system
Information the system must have before it
can run any of the application's code.
Remember this?
Manifest
Name of the Java package for the
application.

It describes the components of
the application
the activities, services, broadcast receivers, and
content providers.
Manifest
It declares which permissions the
application must have in order to
access protected parts of the API and
interact with other applications.

It declares the minimum level of the
Android API that the application
requires … and much more.
MODIFICATION IN ANDROID MANIFEST

Declares an activity (an Activity
subclass) that implements part of the
application’s visual user interface.

<activity android:name=".OtherClass">
<intent-filter>
<action android:name="android.intent.action.NAME"/>
<category
android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
The types of intents that an app can
respond to

Adds an action to an intent filter

Adds a category name to an intent
filter
In MainActivity
Intent i = new Intent(MainActivity.this,
OtherClass.class); // Instantiating the intent
class
i.putExtra(“name”, value); // values to be sent
startActivity(i); // Starting the intent

In OtherClass
Intent i = getIntent(); //getting the intent
object
String name = i.getStringExtra(“name”); //
getting value from passed intent

Intents
HAVE YOU EVER WONDERED
WHAT HAPPENS WHEN YOU
PRESS THE BACK BUTTON/
HOME BUTTON ON ANDROID?
Activity
Life
Cycle
Activity
Life
Cycle

onCreate() :
instantiate views, setup
references, implement
listeners.

onPause() :
save data/state in the
application.

onResume() :
can be used to load the
saved state, is always
called when the application
comes into view.
THAT’S ALL FOLKS!
WE’LL SEE YOU TOMORROW

Weitere ähnliche Inhalte

Was ist angesagt?

Filters in AngularJS
Filters in AngularJSFilters in AngularJS
Filters in AngularJS
Brajesh Yadav
 

Was ist angesagt? (20)

Android xml-based layouts-chapter5
Android xml-based layouts-chapter5Android xml-based layouts-chapter5
Android xml-based layouts-chapter5
 
Android Training (Android UI)
Android Training (Android UI)Android Training (Android UI)
Android Training (Android UI)
 
Angular js
Angular jsAngular js
Angular js
 
Android Screen Containers & Layouts
Android Screen Containers & LayoutsAndroid Screen Containers & Layouts
Android Screen Containers & Layouts
 
Filters in AngularJS
Filters in AngularJSFilters in AngularJS
Filters in AngularJS
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
 
Android L08 - Google Maps and Utilities
Android L08 - Google Maps and UtilitiesAndroid L08 - Google Maps and Utilities
Android L08 - Google Maps and Utilities
 
iOS Layout Overview
iOS Layout OverviewiOS Layout Overview
iOS Layout Overview
 
AngularJS - Services
AngularJS - ServicesAngularJS - Services
AngularJS - Services
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete Course
 
Solid angular
Solid angularSolid angular
Solid angular
 
AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation
 
Design for succcess with react and storybook.js
Design for succcess with react and storybook.jsDesign for succcess with react and storybook.js
Design for succcess with react and storybook.js
 
Android Ui
Android UiAndroid Ui
Android Ui
 
Basic Android Layout
Basic Android LayoutBasic Android Layout
Basic Android Layout
 
Violet Peña - Storybook: A React Tool For Your Whole Team
Violet Peña - Storybook: A React Tool For Your Whole TeamViolet Peña - Storybook: A React Tool For Your Whole Team
Violet Peña - Storybook: A React Tool For Your Whole Team
 
Creation of simple application using - step by step
Creation of simple application using - step by stepCreation of simple application using - step by step
Creation of simple application using - step by step
 
Introduction to React for Frontend Developers
Introduction to React for Frontend DevelopersIntroduction to React for Frontend Developers
Introduction to React for Frontend Developers
 
06. Android Basic Widget and Container
06. Android Basic Widget and Container06. Android Basic Widget and Container
06. Android Basic Widget and Container
 
List Views
List ViewsList Views
List Views
 

Ähnlich wie Training Session 2 - Day 2

Mobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfMobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdf
AbdullahMunir32
 

Ähnlich wie Training Session 2 - Day 2 (20)

Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android Apps
 
Android App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structureAndroid App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structure
 
Android Tutorial
Android TutorialAndroid Tutorial
Android Tutorial
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_android
 
Getting started with android programming
Getting started with android programmingGetting started with android programming
Getting started with android programming
 
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)
 
Part 2 android application development 101
Part 2 android application development 101Part 2 android application development 101
Part 2 android application development 101
 
Marakana Android User Interface
Marakana Android User InterfaceMarakana Android User Interface
Marakana Android User Interface
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
 
Android应用开发简介
Android应用开发简介Android应用开发简介
Android应用开发简介
 
Android training day 2
Android training day 2Android training day 2
Android training day 2
 
Android Development Basics
Android Development BasicsAndroid Development Basics
Android Development Basics
 
Basics and different xml files used in android
Basics and different xml files used in androidBasics and different xml files used in android
Basics and different xml files used in android
 
Synapseindia android apps introduction hello world
Synapseindia android apps introduction hello worldSynapseindia android apps introduction hello world
Synapseindia android apps introduction hello world
 
Mobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfMobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdf
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Android Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectAndroid Development Made Easy - With Sample Project
Android Development Made Easy - With Sample Project
 
Android Starting App Development
Android  Starting App DevelopmentAndroid  Starting App Development
Android Starting App Development
 
Android Basic- CMC
Android Basic- CMCAndroid Basic- CMC
Android Basic- CMC
 

Mehr von Vivek Bhusal (11)

Day 6
Day 6Day 6
Day 6
 
Day 5
Day 5Day 5
Day 5
 
Android training day 5
Android training day 5Android training day 5
Android training day 5
 
Android training day 4
Android training day 4Android training day 4
Android training day 4
 
Android training day 3
Android training day 3Android training day 3
Android training day 3
 
Android training day 1
Android training day 1Android training day 1
Android training day 1
 
Stores munk presentation_aug10 (1)
Stores munk presentation_aug10 (1)Stores munk presentation_aug10 (1)
Stores munk presentation_aug10 (1)
 
Mybudget
MybudgetMybudget
Mybudget
 
Wisevote - opendataweek @
Wisevote - opendataweek @Wisevote - opendataweek @
Wisevote - opendataweek @
 
Android training at GDG kathmandu Startup weekend bootcamp
Android training at GDG kathmandu Startup weekend bootcampAndroid training at GDG kathmandu Startup weekend bootcamp
Android training at GDG kathmandu Startup weekend bootcamp
 
My medical info
My medical infoMy medical info
My medical info
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

Training Session 2 - Day 2

  • 3.
  • 4. Android is built on top of Linux kernel.
  • 5. Android is built on top of Linux kernel. Android uses a number of libraries to perform various functionalities.
  • 6. Android is built on top of Linux kernel. Android uses a number of libraries to perform various functionalities. Just like the Java Virtual Machine in our computers, Android has its own Dalvik Virtual Machine optimized for itself.
  • 7. Android is built on top of Linux kernel. Android uses a number of libraries to perform various functionalities. Just like the Java Virtual Machine in our computers, Android has its own Dalvik Virtual Machine optimized for itself. Higher-level services to applications in the form of Java classes: Application Framework.
  • 8. Android is built on top of Linux kernel. Android uses a number of libraries to perform various functionalities. Just like the Java Virtual Machine in our computers, Android has its own Dalvik Virtual Machine optimized for itself. Higher-level services to applications in the form of Java classes: Application Framework. We will write applications to be installed on the Application layer only.
  • 10. Android’s defined tags Introduction to xml   Used to define some of the resources -  Layouts -  Strings Used in Android Manifest Preferred way for defining UI elements -  Separation of code
  • 12. LO AU YT Eclipse has a great UI creator -  Generates all the xml for you Composed of View objects Can be specified for portrait or landscape -  Different designs for different orientation.
  • 13. VIEWS A layout/activity is composed of Views and ViewGroups. View is something that is visible. Examples: -  -  -  -  TextViews, Buttons, TimePicker, DatePicker
  • 14. VIEWS 3 ways to declare width and height a.  b.  c.  fill_parent wrap_content match_parent <Button android:id = “@+id/button” android:layout_width = “fill_parent” android:layout_height = “wrap_content” android:text = “Button”/> { DO NOT FORGET TO DEFINE US
  • 15. VIEWS { <EditText android:id = “@+id/number” android:layout_width = “fill_parent” android:layout_height = “wrap_content” android:text = “number”/> You can change the type of inputs as necessary
  • 16. VIEWS <TextView android:id = “@+id/result” android:layout_height = “wrap_parent” android:layout_weight = “fill_content” android:text = “invisible”/> 3 ways to declare visibility a.  b.  c.  visible invisible gone
  • 17. FrameLayout 4 One or more View can be grouped into a ViewGroup RelativeLayout 3 This is the <body> to your view. LinearLayout 2 ViewGroups 1 TableLayout 5 ScrollView, etc.
  • 18. Each layout has something unique to it. Each layout has a purpose!
  • 19. LinearLayout Declaring the XML namespace (done in the 1st ViewGroup) <LinearLayout xmlns:android=“http://schemas.android.com/apk/res/ android” android:layout_width= “match_parent” android:layout_height= “match_parent” android:orientation= “vertical”> … (TextViews, Buttons etc.) </LinearLayout> Unique for this ViewGroup a.  Vertical b.  Horizontal
  • 20. RelativeLayout Does not have any android:orientation. Affects the layouts inside it Views are arranged according to references.
  • 21. RelativeLayout <RelativeLayout ..> <Button android:id= “@+id/btn” android:layout_alignParentTop= "true" … /> <TextView android:layout_below = “@id/btn” … /> <TextView android:layout_toRightOf = “@id/btn” …/> <TextView android:layout_toLeftOf = “@id/btn” …/> <TextView android:layout_alignParentBottom = “true” .../> </RelativeLayout> Various other positioning techniques also there: alignLeft alignBaseLine above, etc.
  • 23. LETS UNITE! <LinearLayout … > <RelativeLayout … > … </RelativeLayout> </LinearLayout>
  • 24. You can use ViewGroup within ViewGroup LAYOUTCEPTION!
  • 26. ENTS <a href= “target”>page 2</a> Intent ~ Redirecting ! Intent is used to call into android's drivers, other applications as well. Powerful inter/intra application messagepassing framework. While working with intents we also have to work with the Android Manifest
  • 27. Android Manifest Presents essential information about the application to the Android system Information the system must have before it can run any of the application's code.
  • 29. Manifest Name of the Java package for the application. It describes the components of the application the activities, services, broadcast receivers, and content providers.
  • 30. Manifest It declares which permissions the application must have in order to access protected parts of the API and interact with other applications. It declares the minimum level of the Android API that the application requires … and much more.
  • 31. MODIFICATION IN ANDROID MANIFEST Declares an activity (an Activity subclass) that implements part of the application’s visual user interface. <activity android:name=".OtherClass"> <intent-filter> <action android:name="android.intent.action.NAME"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> The types of intents that an app can respond to Adds an action to an intent filter Adds a category name to an intent filter
  • 32. In MainActivity Intent i = new Intent(MainActivity.this, OtherClass.class); // Instantiating the intent class i.putExtra(“name”, value); // values to be sent startActivity(i); // Starting the intent In OtherClass Intent i = getIntent(); //getting the intent object String name = i.getStringExtra(“name”); // getting value from passed intent Intents
  • 33. HAVE YOU EVER WONDERED WHAT HAPPENS WHEN YOU PRESS THE BACK BUTTON/ HOME BUTTON ON ANDROID?
  • 35. Activity Life Cycle onCreate() : instantiate views, setup references, implement listeners. onPause() : save data/state in the application. onResume() : can be used to load the saved state, is always called when the application comes into view.
  • 36. THAT’S ALL FOLKS! WE’LL SEE YOU TOMORROW