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 ...
Android is built on top of Linux kernel.
Android uses a number of libraries to perform various functionalities.
Just like ...
Android is built on top of Linux kernel.
Android uses a number of libraries to perform various functionalities.
Just like ...
Introduction to

xml	
  
Android’s defined tags

Introduction to

xml	
  

Used to define some of
the resources
-  Layouts
-  Strings
Used in Android...
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 po...
VIEWS
A layout/activity is composed of
Views and ViewGroups.
View is something that is visible.
Examples:
- 
- 
- 
- 

Tex...
VIEWS
3 ways to declare width and height

a. 
b. 
c. 

fill_parent
wrap_content
match_parent

<Button
android:id = “@+id/bu...
VIEWS

{

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

<TextView
android:id = “@+id/result”
android:layout_height = “wrap_parent”
android:layout_weight = “fill_content”
a...
FrameLayout

4

One or more View can be
grouped into a ViewGroup

RelativeLayout

3

This is the <body> to your
view.

Lin...
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....
RelativeLayout

Does not have any android:orientation.

Affects the layouts inside it

Views are arranged according to ref...
RelativeLayout

<RelativeLayout ..>
<Button android:id= “@+id/btn”
android:layout_alignParentTop= "true" … />
<TextView an...
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 applicati...
Android Manifest
Presents essential information
about the application to the
Android system
Information the system must ha...
Remember this?
Manifest
Name of the Java package for the
application.

It describes the components of
the application
the activities, ser...
Manifest
It declares which permissions the
application must have in order to
access protected parts of the API and
interac...
MODIFICATION IN ANDROID MANIFEST

Declares an activity (an Activity
subclass) that implements part of the
application’s vi...
In MainActivity
Intent i = new Intent(MainActivity.this,
OtherClass.class); // Instantiating the intent
class
i.putExtra(“...
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 i...
THAT’S ALL FOLKS!
WE’LL SEE YOU TOMORROW
Training Session 2 - Day 2
Upcoming SlideShare
Loading in...5
×

Training Session 2 - Day 2

1,101

Published on

Android System architecture
Brief introduction to XML
- Layout, View and View Groups
Intent and Intent Filter
Android Manifest
Android Life Cycle

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,101
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
48
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Training Session 2 - Day 2

  1. 1. HELLO WE MEET AGAIN 
  2. 2. Android System Architecture
  3. 3. Android is built on top of Linux kernel.
  4. 4. Android is built on top of Linux kernel. Android uses a number of libraries to perform various functionalities.
  5. 5. 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.
  6. 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. Higher-level services to applications in the form of Java classes: Application Framework.
  7. 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. We will write applications to be installed on the Application layer only.
  8. 8. Introduction to xml  
  9. 9. 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
  10. 10. Simple UI
  11. 11. 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.
  12. 12. VIEWS A layout/activity is composed of Views and ViewGroups. View is something that is visible. Examples: -  -  -  -  TextViews, Buttons, TimePicker, DatePicker
  13. 13. 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
  14. 14. 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
  15. 15. 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
  16. 16. 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.
  17. 17. Each layout has something unique to it. Each layout has a purpose!
  18. 18. 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
  19. 19. RelativeLayout Does not have any android:orientation. Affects the layouts inside it Views are arranged according to references.
  20. 20. 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.
  21. 21. LinearLayout vs RelativeLayout
  22. 22. LETS UNITE! <LinearLayout … > <RelativeLayout … > … </RelativeLayout> </LinearLayout>
  23. 23. You can use ViewGroup within ViewGroup LAYOUTCEPTION!
  24. 24. INTENTS
  25. 25. 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
  26. 26. 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.
  27. 27. Remember this?
  28. 28. Manifest Name of the Java package for the application. It describes the components of the application the activities, services, broadcast receivers, and content providers.
  29. 29. 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.
  30. 30. 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
  31. 31. 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
  32. 32. HAVE YOU EVER WONDERED WHAT HAPPENS WHEN YOU PRESS THE BACK BUTTON/ HOME BUTTON ON ANDROID?
  33. 33. Activity Life Cycle
  34. 34. 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.
  35. 35. THAT’S ALL FOLKS! WE’LL SEE YOU TOMORROW
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×