SlideShare a Scribd company logo
1 of 40
ANDROID TRAINING
SESSION – 2
-Hussain KMR Behestee
AGENDAS
• UI Design for Android
– Layout
– Drawable
• Activity
• Intent
– Explicit Intent
– Implicite Intent
UI DESIGN FOR ANDROID
UI DESIGN FOR ANDROID
• Layout
– Common layout
• Linear layout
• Relative layout
– Layout with adapter
• Grid View
• List View
LAYOUT
COMMON LAYOUT
Linear Relative
LINEAR LAYOUT
RELATIVE LAYOUT
RELATIVE LAYOUT
• android:layout_alignParentTop
– If "true", makes the top edge of this view match the top edge of the
parent.
• android:layout_centerVertical
– If "true", centers this child vertically within its parent.
• android:layout_below
– Positions the top edge of this view below the view specified with a
resource ID.
• android:layout_toRightOf
– Positions the left edge of this view to the right of the view specified
with a resource ID.
These are just a few examples. All layout attributes are documented at
RelativeLayout.LayoutParams.
LAYOUT WITH ADAPTER
Grid View List View
GRIDS
GRIDS
LIST
LIST
Creating
adapter
Setting
adapter
Adding click
listener
UI DESIGN FOR ANDROID
• Drawables
– State List
• Drawable / Color
– Styles
– Themes
– Menu
– Nine-Patch
STATE LIST
— android:state_pressed
— android:state_focused
— android:state_hovered
— android:state_selected
— android:state_checkable
— android:state_checked
— android:state_enabled
— android:state_activated
— android:state_window_focused
DRAWABLE / COLOR
• android:drawable
– Drawable resource. Required. Reference to a
drawable resource
• android:color
– Hexadeximal color. Required. RGB value or Alpha-
Red-Green-Blue
DRAWABLE / COLOR
android:drawable
- File name with res/drawable/button.xml
DRAWABLE / COLOR
android:color
- File name with res/color/buttontext.xml
DRAWABLE / COLOR
STYLES
Inline
styles
Styles
definition
Using
style
STYLES
• Inheritance – by adding parent it can be inherited:
<style name="GreenText" parent="@android:style/TextAppearance">
<item name="android:textColor">#00FF00</item>
</style>
• If the parent is your style then don’t use parent, Just make the prefix:
<style name="CodeFont.Red">
<item name="android:textColor">#FF0000</item>
</style>
[refrence will be : @style/CodeFont.Red.]
• You can continue inheritance this way:
<style name="CodeFont.Red.Big">
<item name="android:textSize">30sp</item>
</style>
THEMES
• To set a theme for all the activities of your application, open the
AndroidManifest.xml file and edit the <application> tag to include the
android:theme attribute with the style name. For example:
• If you want a theme applied to just one Activity in your application, then
add the android:theme attribute to the <activity> tag instead.
THEMES
• If you like a theme, but want to tweak it, just add the theme as the parent
of your custom theme. For example, you can modify the traditional light
theme to use your own color like this:
• Now use CustomTheme instead of Theme.Light inside the Android
Manifest:
• Android Styles (styles.xml)
• Android Themes (themes.xml)
MENU
• Beginning with Android 3.0 (API level 11), the action bar is included
• If you've created a custom theme, be sure it uses one of the Theme.Holo
themes as its parent. For details, see Styling the Action Bar.
• Adding the action bar when running on versions older than Android 3.0
(down to Android 2.1 [API level 7]) requires that you include the Android
Support Library in your application.
• Update your activity so that it extends ActionBarActivity. For example:
• In your manifest file, update either the <application> element or individual
<activity> elements to use one of the Theme.AppCompat themes. For
example:
MENU / ACTION BAR
• Adding Action Buttons
• Specify the Actions in XML
MENU / ACTION BAR
• If your app is using the Support Library, the showAsAction attribute is not
available from the android: namespace.
[NB: A custom XML namespace should be based on your app name, but it
can be any name you want and is only accessible within the scope of the file
in which you declare it.]
MENU / ACTION BAR
• Add the Actions to the Action Bar:
MENU / ACTION BAR
• Respond to Action Buttons:
MENU / ACTION BAR
• Add Up Button for Low-level Activities like as:-
• Add the Parent Activity for a child activity as bellow:
NINE-PATCH
• Launch the draw9patch
application from your SDK /tools
directory
• File > Open 9-patch... to locate the
file
• Click within the 1-pixel perimeter to
draw the lines that define the
stretchable patches and (optional)
content area. Right-click (or hold Shift
and click, on Mac) to erase previously
drawn lines.
• When done, select File > Save 9-
patch... Your image will be saved with
the .9.png file name.
ACTIVITY
• Understand the Lifecycle Callbacks
ACTIVITY
• Specify Your App's Launcher Activity
• You need to know all that facts clearly for better designing the Application:
– Does not crash if the user receives a phone call or switches to another app while using
your app.
– Does not consume valuable system resources when the user is not actively using it.
– Does not lose the user's progress if they leave your app and return to it at a later time.
– Does not crash or lose the user's progress when the screen rotates between landscape
and portrait orientation.
ACTIVITY
• Save Your Activity State
ACTIVITY
• Restore Your Activity State
INTENT
• Explicit Intent:
– We generally do so with an explicit intent, which defines the exact class name of the
component you want to start.
• Implicite Intent:
– when we want to have a separate app perform an action, such as "view a
map," you must use an implicit intent.
IMPLICITE INTENT
• View a web page:
• To make a phone call from your app:
• Send an email with an attachment:
IMPLICITE INTENT
• Caution: If you invoke an intent and there is no app available on the device
that can handle the intent, your app will crash.
• To verify there is an activity available that can respond to the intent, call
queryIntentActivities() to get a list of activities capable of handling your
Intent. If the returned List is not empty, you can safely use the intent. For
example:
• Please see details at here.
QUESTION?
THANK YOU

More Related Content

Viewers also liked

Dalvik Source Code Reading
Dalvik Source Code ReadingDalvik Source Code Reading
Dalvik Source Code Readingkishima7
 
Form Handling using PHP
Form Handling using PHPForm Handling using PHP
Form Handling using PHPNisa Soomro
 
Android Life Cycle
Android Life CycleAndroid Life Cycle
Android Life Cyclemssaman
 
Android life cycle
Android life cycleAndroid life cycle
Android life cycle瑋琮 林
 
Android Studio NDK(JNI) + OpenCV 完整教學
Android Studio NDK(JNI) + OpenCV 完整教學Android Studio NDK(JNI) + OpenCV 完整教學
Android Studio NDK(JNI) + OpenCV 完整教學Wei-Xiang Wang
 
Android: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversAndroid: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversCodeAndroid
 
Android Lesson 3 - Intent
Android Lesson 3 - IntentAndroid Lesson 3 - Intent
Android Lesson 3 - IntentDaniela Da Cruz
 
Android - Broadcast Receiver
Android - Broadcast ReceiverAndroid - Broadcast Receiver
Android - Broadcast ReceiverYong Heui Cho
 
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginMastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginXavier Hallade
 

Viewers also liked (10)

Dalvik Source Code Reading
Dalvik Source Code ReadingDalvik Source Code Reading
Dalvik Source Code Reading
 
Form Handling using PHP
Form Handling using PHPForm Handling using PHP
Form Handling using PHP
 
Android Life Cycle
Android Life CycleAndroid Life Cycle
Android Life Cycle
 
Android life cycle
Android life cycleAndroid life cycle
Android life cycle
 
Android intents
Android intentsAndroid intents
Android intents
 
Android Studio NDK(JNI) + OpenCV 完整教學
Android Studio NDK(JNI) + OpenCV 完整教學Android Studio NDK(JNI) + OpenCV 完整教學
Android Studio NDK(JNI) + OpenCV 完整教學
 
Android: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversAndroid: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast Receivers
 
Android Lesson 3 - Intent
Android Lesson 3 - IntentAndroid Lesson 3 - Intent
Android Lesson 3 - Intent
 
Android - Broadcast Receiver
Android - Broadcast ReceiverAndroid - Broadcast Receiver
Android - Broadcast Receiver
 
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginMastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
 

Similar to Android session 2-behestee

Chapter 2 lesson-1 adding the action bar
Chapter 2 lesson-1 adding the action barChapter 2 lesson-1 adding the action bar
Chapter 2 lesson-1 adding the action barKalluri Vinay Reddy
 
Designing and implementing_android_uis_for_phones_and_tablets
Designing and implementing_android_uis_for_phones_and_tabletsDesigning and implementing_android_uis_for_phones_and_tablets
Designing and implementing_android_uis_for_phones_and_tabletsTeddy Koornia
 
MD-IV-CH-ppt.ppt
MD-IV-CH-ppt.pptMD-IV-CH-ppt.ppt
MD-IV-CH-ppt.pptbharatt7
 
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 androidMahmudul Hasan
 
mobile application development -unit-3-
mobile application development  -unit-3-mobile application development  -unit-3-
mobile application development -unit-3-TejamFandat
 
Android lifecycle
Android lifecycleAndroid lifecycle
Android lifecycleKumar
 
11.11.2020 - Unit 5-3 ACTIVITY, MENU AND SQLITE DATABASE.pptx
11.11.2020 - Unit 5-3  ACTIVITY, MENU AND SQLITE DATABASE.pptx11.11.2020 - Unit 5-3  ACTIVITY, MENU AND SQLITE DATABASE.pptx
11.11.2020 - Unit 5-3 ACTIVITY, MENU AND SQLITE DATABASE.pptxMugiiiReee
 
Building a simple user interface lesson2
Building a simple user interface lesson2Building a simple user interface lesson2
Building a simple user interface lesson2Kalluri Vinay Reddy
 
Android building blocks and application life cycle-chapter3
Android building blocks and application life cycle-chapter3Android building blocks and application life cycle-chapter3
Android building blocks and application life cycle-chapter3Dr. Ramkumar Lakshminarayanan
 
m365_slides.pptx
m365_slides.pptxm365_slides.pptx
m365_slides.pptxadewad
 
Android introduction
Android introductionAndroid introduction
Android introductionPingLun Liao
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development PracticesRoy Clarkson
 
Learn Xamarin Absolute Beginners - Permissions, Building the App GUI & Menus
Learn Xamarin Absolute Beginners - Permissions, Building the App GUI & MenusLearn Xamarin Absolute Beginners - Permissions, Building the App GUI & Menus
Learn Xamarin Absolute Beginners - Permissions, Building the App GUI & MenusEng Teong Cheah
 

Similar to Android session 2-behestee (20)

Chapter 2 lesson-1 adding the action bar
Chapter 2 lesson-1 adding the action barChapter 2 lesson-1 adding the action bar
Chapter 2 lesson-1 adding the action bar
 
Designing and implementing_android_uis_for_phones_and_tablets
Designing and implementing_android_uis_for_phones_and_tabletsDesigning and implementing_android_uis_for_phones_and_tablets
Designing and implementing_android_uis_for_phones_and_tablets
 
MD-IV-CH-ppt.ppt
MD-IV-CH-ppt.pptMD-IV-CH-ppt.ppt
MD-IV-CH-ppt.ppt
 
Android ui with xml
Android ui with xmlAndroid ui with xml
Android ui with xml
 
Ap quiz app
Ap quiz appAp quiz app
Ap quiz app
 
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
 
mobile application development -unit-3-
mobile application development  -unit-3-mobile application development  -unit-3-
mobile application development -unit-3-
 
Lesson 10
Lesson 10Lesson 10
Lesson 10
 
Android lifecycle
Android lifecycleAndroid lifecycle
Android lifecycle
 
11.11.2020 - Unit 5-3 ACTIVITY, MENU AND SQLITE DATABASE.pptx
11.11.2020 - Unit 5-3  ACTIVITY, MENU AND SQLITE DATABASE.pptx11.11.2020 - Unit 5-3  ACTIVITY, MENU AND SQLITE DATABASE.pptx
11.11.2020 - Unit 5-3 ACTIVITY, MENU AND SQLITE DATABASE.pptx
 
Building a simple user interface lesson2
Building a simple user interface lesson2Building a simple user interface lesson2
Building a simple user interface lesson2
 
Android building blocks and application life cycle-chapter3
Android building blocks and application life cycle-chapter3Android building blocks and application life cycle-chapter3
Android building blocks and application life cycle-chapter3
 
m365_slides.pptx
m365_slides.pptxm365_slides.pptx
m365_slides.pptx
 
Android development part 2
Android development part 2Android development part 2
Android development part 2
 
Android development part 2
Android development part 2Android development part 2
Android development part 2
 
Android app development guide for freshers by ace web academy
Android app development guide for freshers  by ace web academyAndroid app development guide for freshers  by ace web academy
Android app development guide for freshers by ace web academy
 
Ui 5
Ui   5Ui   5
Ui 5
 
Android introduction
Android introductionAndroid introduction
Android introduction
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development Practices
 
Learn Xamarin Absolute Beginners - Permissions, Building the App GUI & Menus
Learn Xamarin Absolute Beginners - Permissions, Building the App GUI & MenusLearn Xamarin Absolute Beginners - Permissions, Building the App GUI & Menus
Learn Xamarin Absolute Beginners - Permissions, Building the App GUI & Menus
 

More from Hussain Behestee

More from Hussain Behestee (7)

Android session-1-sajib
Android session-1-sajibAndroid session-1-sajib
Android session-1-sajib
 
Android session-5-sajib
Android session-5-sajibAndroid session-5-sajib
Android session-5-sajib
 
Android session 3-behestee
Android session 3-behesteeAndroid session 3-behestee
Android session 3-behestee
 
Android session 4-behestee
Android session 4-behesteeAndroid session 4-behestee
Android session 4-behestee
 
iOS Training Session-3
iOS Training Session-3iOS Training Session-3
iOS Training Session-3
 
iOS Session-2
iOS Session-2iOS Session-2
iOS Session-2
 
iOS app dev Training - Session1
iOS app dev Training - Session1iOS app dev Training - Session1
iOS app dev Training - Session1
 

Recently uploaded

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 

Recently uploaded (20)

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 

Android session 2-behestee

  • 1. ANDROID TRAINING SESSION – 2 -Hussain KMR Behestee
  • 2. AGENDAS • UI Design for Android – Layout – Drawable • Activity • Intent – Explicit Intent – Implicite Intent
  • 3. UI DESIGN FOR ANDROID
  • 4. UI DESIGN FOR ANDROID • Layout – Common layout • Linear layout • Relative layout – Layout with adapter • Grid View • List View
  • 9. RELATIVE LAYOUT • android:layout_alignParentTop – If "true", makes the top edge of this view match the top edge of the parent. • android:layout_centerVertical – If "true", centers this child vertically within its parent. • android:layout_below – Positions the top edge of this view below the view specified with a resource ID. • android:layout_toRightOf – Positions the left edge of this view to the right of the view specified with a resource ID. These are just a few examples. All layout attributes are documented at RelativeLayout.LayoutParams.
  • 10. LAYOUT WITH ADAPTER Grid View List View
  • 11. GRIDS
  • 12. GRIDS
  • 13. LIST
  • 15. UI DESIGN FOR ANDROID • Drawables – State List • Drawable / Color – Styles – Themes – Menu – Nine-Patch
  • 16. STATE LIST — android:state_pressed — android:state_focused — android:state_hovered — android:state_selected — android:state_checkable — android:state_checked — android:state_enabled — android:state_activated — android:state_window_focused
  • 17. DRAWABLE / COLOR • android:drawable – Drawable resource. Required. Reference to a drawable resource • android:color – Hexadeximal color. Required. RGB value or Alpha- Red-Green-Blue
  • 18. DRAWABLE / COLOR android:drawable - File name with res/drawable/button.xml
  • 19. DRAWABLE / COLOR android:color - File name with res/color/buttontext.xml
  • 22. STYLES • Inheritance – by adding parent it can be inherited: <style name="GreenText" parent="@android:style/TextAppearance"> <item name="android:textColor">#00FF00</item> </style> • If the parent is your style then don’t use parent, Just make the prefix: <style name="CodeFont.Red"> <item name="android:textColor">#FF0000</item> </style> [refrence will be : @style/CodeFont.Red.] • You can continue inheritance this way: <style name="CodeFont.Red.Big"> <item name="android:textSize">30sp</item> </style>
  • 23. THEMES • To set a theme for all the activities of your application, open the AndroidManifest.xml file and edit the <application> tag to include the android:theme attribute with the style name. For example: • If you want a theme applied to just one Activity in your application, then add the android:theme attribute to the <activity> tag instead.
  • 24. THEMES • If you like a theme, but want to tweak it, just add the theme as the parent of your custom theme. For example, you can modify the traditional light theme to use your own color like this: • Now use CustomTheme instead of Theme.Light inside the Android Manifest: • Android Styles (styles.xml) • Android Themes (themes.xml)
  • 25. MENU • Beginning with Android 3.0 (API level 11), the action bar is included • If you've created a custom theme, be sure it uses one of the Theme.Holo themes as its parent. For details, see Styling the Action Bar. • Adding the action bar when running on versions older than Android 3.0 (down to Android 2.1 [API level 7]) requires that you include the Android Support Library in your application. • Update your activity so that it extends ActionBarActivity. For example: • In your manifest file, update either the <application> element or individual <activity> elements to use one of the Theme.AppCompat themes. For example:
  • 26. MENU / ACTION BAR • Adding Action Buttons • Specify the Actions in XML
  • 27. MENU / ACTION BAR • If your app is using the Support Library, the showAsAction attribute is not available from the android: namespace. [NB: A custom XML namespace should be based on your app name, but it can be any name you want and is only accessible within the scope of the file in which you declare it.]
  • 28. MENU / ACTION BAR • Add the Actions to the Action Bar:
  • 29. MENU / ACTION BAR • Respond to Action Buttons:
  • 30. MENU / ACTION BAR • Add Up Button for Low-level Activities like as:- • Add the Parent Activity for a child activity as bellow:
  • 31. NINE-PATCH • Launch the draw9patch application from your SDK /tools directory • File > Open 9-patch... to locate the file • Click within the 1-pixel perimeter to draw the lines that define the stretchable patches and (optional) content area. Right-click (or hold Shift and click, on Mac) to erase previously drawn lines. • When done, select File > Save 9- patch... Your image will be saved with the .9.png file name.
  • 32. ACTIVITY • Understand the Lifecycle Callbacks
  • 33. ACTIVITY • Specify Your App's Launcher Activity • You need to know all that facts clearly for better designing the Application: – Does not crash if the user receives a phone call or switches to another app while using your app. – Does not consume valuable system resources when the user is not actively using it. – Does not lose the user's progress if they leave your app and return to it at a later time. – Does not crash or lose the user's progress when the screen rotates between landscape and portrait orientation.
  • 34. ACTIVITY • Save Your Activity State
  • 35. ACTIVITY • Restore Your Activity State
  • 36. INTENT • Explicit Intent: – We generally do so with an explicit intent, which defines the exact class name of the component you want to start. • Implicite Intent: – when we want to have a separate app perform an action, such as "view a map," you must use an implicit intent.
  • 37. IMPLICITE INTENT • View a web page: • To make a phone call from your app: • Send an email with an attachment:
  • 38. IMPLICITE INTENT • Caution: If you invoke an intent and there is no app available on the device that can handle the intent, your app will crash. • To verify there is an activity available that can respond to the intent, call queryIntentActivities() to get a list of activities capable of handling your Intent. If the returned List is not empty, you can safely use the intent. For example: • Please see details at here.